cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

DaPu_2346716
New Contributor

I created a port that uses 16 pins on the processor. These are simply feeding LEDs that I want to update at the same time every time. This spans across multiple ports: P0[0..6], P1[0..3], P1[7], and P2[0..3]. I see that I'm able to map them as spanning but how to I reference the whole port in code?

0 Likes
1 Solution
GeonaP_26
Moderator
Moderator

Adding on to the reply;

There are two ways to access Pins Component, i.e., on a per-pin basis as well as on component-wide basis.

  • If pins are contiguous, component wide API functions (Eg: LED_Read()) will get generated. This will write/read to all pins together.
  • If pins are non-contiguous, you can use per-pin API (Eg: CyPins_ReadPin(LED_0)). Please refer to System Reference Guide (PSoC Creator, Help>System Reference Guide) for more details.

Per-pin API are generated for both cases. You can use this function to update data registers in your application. The aliases (Eg: LED_0 or LED_<AliasName>) for the pin registers are available in the LED_aliases.h file, where "LED" is the instance name of the Pins Component. You can find more details in section 'Per-Pin API' of Pins component datasheet.

View solution in original post

0 Likes
2 Replies
DaPu_2346716
New Contributor

I checked with my FAE and he said, "Looks like from this you do not get APIs generated for bus control.

You will have to write a single function for writing each port data register based on the 16 bits passed to the function."

Contiguous vs Spanning.jpg

GeonaP_26
Moderator
Moderator

Adding on to the reply;

There are two ways to access Pins Component, i.e., on a per-pin basis as well as on component-wide basis.

  • If pins are contiguous, component wide API functions (Eg: LED_Read()) will get generated. This will write/read to all pins together.
  • If pins are non-contiguous, you can use per-pin API (Eg: CyPins_ReadPin(LED_0)). Please refer to System Reference Guide (PSoC Creator, Help>System Reference Guide) for more details.

Per-pin API are generated for both cases. You can use this function to update data registers in your application. The aliases (Eg: LED_0 or LED_<AliasName>) for the pin registers are available in the LED_aliases.h file, where "LED" is the instance name of the Pins Component. You can find more details in section 'Per-Pin API' of Pins component datasheet.

View solution in original post

0 Likes