PSOC6 and parallel port read over 16 pins for an external ADC

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

cross mob
RiTa_288331
Level 2
Level 2
10 replies posted 10 questions asked 5 replies posted

Greetings!

Using a PSOC6 BLE Pioneer kit with an external 16-bit parallel ADC.  I want to trigger the ADC to convert (let's say, at a 20kHz rate), then interrupt on the ADC "done signal", and then read the 16 data pins from the ADC.

On the BLE Pioneer board, there is no group of 16 pins that is contiguous across a single port.  In order to read the 16 data pins, I can do one of two things:

1. Read pins in software:

*Pseudo code here*

[In "ADC conversion done" interrupt]:

ADC_RESULT = Cy_GPIO_Read(Port 7, pin 6) |               //ADC bit 0

                          Cy_GPIO_Read(Port 7, pin 7)  << 1 |      //ADC bit 1

                          Cy_GPIO_Read(Port 9, pin 0)  << 2 |      //ADC bit 2

                          Cy_GPIO_Read(Port 10, pin 0)  << 3 |    //ADC bit 3.... (do this for all 16 pins)

2. Read pins from two "8-bit" Status registers in the Creator schematic:

[In "ADC conversion done" interrupt]:

         ADC_RESULT = StatusReg1_Read()    |    (StatusReg2_Read() << 8);      

   

Is one of these methods faster than the other?  Is there a third option that could read all 16 pins even faster?

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

RiTa,

Since reading speed is slow (20kHz), the method is not important. I believe that speed difference is about 2x times.

Another option is "atomic" reading:

32-bit parallel non-contiguous GPIO write technique

/odissey1

View solution in original post

0 Likes
1 Reply
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

RiTa,

Since reading speed is slow (20kHz), the method is not important. I believe that speed difference is about 2x times.

Another option is "atomic" reading:

32-bit parallel non-contiguous GPIO write technique

/odissey1

0 Likes