Hi hendric , thanks for the input ,
temp_data_out is a throw away variable , i just used it to give this example
the example you show, would only write one byte at a time for each spi write loop and the chip on the SPI requires that the format be - command byte , register byte , number of bytes ,
The number of bytes changes depending on the command and register being used , which can be from min of 3 bytes upto 35 bytes per SPI write string
I have to some sample code for achip that had a SPI built in to one that does not.
shiftout command structure , requires that each byte , to be sent has a "," after each byte , so i need a way to join the bytes into a string for the shiftout command to work
normaly i would code using a string varable to create the string or even just write the data as a string to start with where possible
the string length would vary on the number of bytes to send
since no string variable exists for PICbasic , i can not see how to structure the data as one string for the shiftout command to work when i have a varable amount of bytes to send as one write command
love to see some code that can
Cheers
Sheldon
spi_write:
for x = 1 to number_bytes
temp_data_out = (data_out(x) + "," + temp_data_out )
next x
CSN=0
shiftout SI, SCK, MSBFIRST[ temp_data_out)
CSN=1
return
byte0 s




Bookmarks