- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys.
PSoc Designer amazes me. I can not do ordinary operations(in C)..
When I run below code, it does not works.
FuncCb cbfunc = 0;
void main(void)
{
if (0 == cbfunc) {
f = foo;
f();
}
But When I run below code, it is working
FuncCb cbfunc = 0;
FuncCb x = 0;
void main(void)
{
if (x == cbfunc) {
f = foo;
f();
}
I think it is cast problem. But it is not problem in ANSI C. Does PSoC support all ANSI C rules?
Is there anyone with an idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post the complete project example. We cannot see what runs and what not.
PSoC4 and 5 are running GCC which is ANSI C. PSoC3 might be a bit different.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
typedef void (*FuncCb)(void);
void callbackFunc(void)
{
PRT0DR |= 0x01;
}
FuncCb pFunc = 0; //it used to call related function
FuncCb emptyPointer; // test pointer. it used instead of 0 (NULL)address
void main(void)
{
if (0 == pFunc ) { // if you use emptyPointer instead of "0", it is working. But now it not working.
pFunc = callbackFunc;
pFunc ();
}
while (1)
;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Coderun,
what makes you expect me to
- Create a new project in PSoC Designer 5.???
- Guessing the Chip you used
- Guessing the stack settings you made.
- Pasting your code and then starting to compile
when you could deliver an archive which I could open right out-of-the box.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider posting your project, makes life easier to troubleshoot.
“File” Designer
“Archive Project”
Regards, Dana.