1 Reply Latest reply on Jun 12, 2020 12:26 PM by BoTa_264741

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

    RiTa_288331

      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?