Spin syntax for numbers > 255 w/8 bit SPI engine?
lardom
Posts: 1,659
in Propeller 1
I've seen how ascii characters are clocked in "byte[pointer++] := x". I tried to clock in a value such as 180,000 but anything above 255 was an error. I've been stumped for two days. Do I need a byte array and/or a method to add the values together?
Comments
Erlend
Erlend
Thank you.
It's not clear to me what you want to do. "clock in a value" from where, in what format?
The nrf24L01 is a SPI transceiver. It's configured to clock in 8 bits at a time. I was incrementing a variable from 0 to 255 so I didn't see a problem at first.
I'm working with two demo's. One by Erland and the other by Duane Degn both of which clock strings. I want to control motors so I'm interested in transmitting values.
If you do not change the radio payload length parameter, the radio will expect to transmit and receive 32 bytes, so there will be a lot of waste - instead set the payload length to 4. But a good advice is to only change as little at the time as possible of the demo code, and debug and check you get the results piece by piece, instead of doing a lot of changes and then despair when something does not work.
Erlend
Instead of a long array you can do the same with named longs: and then use the address of the first long as begin of the bytes: byte[@Command]
Andy
I know the 'despair' of overwriting code that works. I try to rename my test code as "V1, V2..." I'm making good progress because for the first two weeks I couldn't transmit anything. I was depressed. I think I'll be ready to test a joystick within a week.
Ariba, I'll copy and paste that. Thanks.