News:

Let's find out together what makes a PIC Tick!

Main Menu

Positron16 array behaviour and SPI_33.inc

Started by Wimax, Sep 06, 2022, 06:03 AM

Previous topic - Next topic

Wimax

Hello Everybody !

I am happily using the read/write routines on SPI offered by "SPI_33.inc" on Positron16 and my "old", dear friend, dsPIC33FJ12GP202. However, I have experienced a strange behavior using a byte array to store the reads taken.
Specifically, using e.g. A[n]=SPI_Read() in a For/Next loop, the values stored in the array were not the data read from the SPI peripheral, but the "n" indices !
I had to use a buffer variable performing two operations in sequence as Mem=SPI_Read() and A[n]=Mem to get the correct result, why ?