PropBASIC - SHIFTOUT - is more than 8 bits ok?
phatallica
Posts: 64
Short version of the question ... is it legal to send more than 8 bits in the PropBASIC SHIFTOUT command?
From the manual:
----
From the manual:
----
SHIFTOUT datapin, clockpin, mode, value[\bits][,speed]
If the bits parameter is not specified, 8 bits are sent.
----
All of the examples that I find are for less than 8 bits.
I intend to write 3 bytes in a row to a device (MCP23S17), which I believe should look like this:
SHIFTOUT MOSI, CLOCK, MSBFIRST, data\24 ' data is LONG variable with information in lowest 3 bytes
This is part of an effort to convert some of my old BS2p code over to PropBASIC. Most of my peripherals used SPI, so if I can get MCP23S17 up-and-running, then the rest should be no problem.
I sincerely appreciate any feedback based on experience with or knowledge of PropBASIC.
~ph
If the bits parameter is not specified, 8 bits are sent.
----
All of the examples that I find are for less than 8 bits.
I intend to write 3 bytes in a row to a device (MCP23S17), which I believe should look like this:
SHIFTOUT MOSI, CLOCK, MSBFIRST, data\24 ' data is LONG variable with information in lowest 3 bytes
This is part of an effort to convert some of my old BS2p code over to PropBASIC. Most of my peripherals used SPI, so if I can get MCP23S17 up-and-running, then the rest should be no problem.
I sincerely appreciate any feedback based on experience with or knowledge of PropBASIC.
~ph
Comments
The link above shows SHIFTIN with 13 bits, so I am confident that I can do the same with SHIFTOUT. Besides, it is Bean's code - no better resource for getting stuff right in PropBASIC.
In process ... Converting - and cleaning up - my old BS2p code now. The subroutines below compile, which is a good sign.
Once I remembered to pull the chip select low for each command ...
And remembered to tie the /Reset pin high ...
And remembered to set the address lines.
The file attached is an extensive framework for MCP23S17, although the working code only sequences some LEDs on Port B. With that working, I feel a little better about diving into the code for each of the peripherals that will connect to it (LCD, switches, HT12D, etc.).
PH_TEMPLATE_MCP23S17.pbas
Bean
Thanks for the kind words, pmrobert.