Parallel Pin read

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ArBi_3167741
Level 1
Level 1
First like given

Hi everyone,

I am trying to configure a counter at 1 MHz frequency to generate an interrupt. At every interrupt point, the processor is supposed to read a 32 pin input value. For this purpose, I need to configure two operations-

1. Configure 32 pins as input and read them with one instruction. ( such as 32 pin port read with one register value)

2. Configure a counter to trigger the read after 1 microsecond.

I have gone through the tutorial videos but I couldn't find any way to configure 32 pin port as a digital input.

Could anyone help me with the right resources to do the required operations? (Tutorial/Documentation etc.).

Thanks.

0 Likes
1 Solution
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

Hello,

All ports in PSoC6 device are of 8 bits. You can use 4 different ports to read the data and store it in one 32 bit variable as shown below.

uint32_t data;

data = (GPIO_PRT9->IN << 24 | GPIO_PRT8->IN << 16 | GPIO_PRT7->IN << 8 | GPIO_PRT6->IN );

Note: The data bits have to be connected in the order PORT6 to PORT9 (LSB to MSB).

Thanks,

Yeshwanth

View solution in original post

6 Replies
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

Hello,

All ports in PSoC6 device are of 8 bits. You can use 4 different ports to read the data and store it in one 32 bit variable as shown below.

uint32_t data;

data = (GPIO_PRT9->IN << 24 | GPIO_PRT8->IN << 16 | GPIO_PRT7->IN << 8 | GPIO_PRT6->IN );

Note: The data bits have to be connected in the order PORT6 to PORT9 (LSB to MSB).

Thanks,

Yeshwanth

You could use 4 status registers connected to your input pins. A single strobe to all registers in parallel wil give you a snapshot of the 32 bits.

To avoid the registers you may use the inclock capability of the pins component, see datasheet.

Bob

Hello Bob,

Thank you for your suggestion. I couldn't understand "A single Strobe " completely is it routing the pins into one register?

I would really appreciate if you could explain it a little bit.

Thanks.

0 Likes
lock attach
Attachments are accessible only for community members.

Here you go...

Bob

0 Likes

Hello Yeshwanth,

Thank you for your reply. In the pin map, I have to define them as input and configure them manually in the code right?

I am new with PSoC that's why I am making sure.

Thanks.

0 Likes
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

PSoC creator will initialize all the pins automatically. You just have to place the pins on the Top Design, configure them as input in GUI and select a pin map.

test.png

Thanks,

Yeshwanth

0 Likes