Anonymous
Not applicable
Sep 21, 2016
03:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 21, 2016
03:16 PM
Given that GPIOs are defined in PSoCGPIOINT.h as, e.g.:
#pragma ioport LED0_Data_ADDR: 0x0 BYTE LED0_Data_ADDR; #define LED0_MASK 0x2
I tried doing something like this in my code:
void SetLED(BYTE *address, BYTE mask) { *address |= mask; } ... SetLED(&LED0_Data_ADDR, LED0_MASK);
That compiled fine, but did not have any effect. It seems like the variables with #pragma ioport can't be referenced and dereferenced like that.
I can't find any in-depth information about #pragma ioport and I/O memory. Is there any way I can qualify pointers to work as intended? Or do pointers to io memory not work in this compiler?
Labels
- Labels:
-
PSoC 1
1 Reply
Sep 22, 2016
01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 22, 2016
01:35 AM
Welcome in the forum, Christopher!
Use pointers to functions instead. You can place some LED components into your design and use an array of pointers to that functions to control the LEDs, See here on how2
As a tip: Change to PSoC4. With debugging capabilities you can get a prototyping kit for few money.
Bob