- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Thanks,
Yeshwanth