Re: Port alias in Port Expanders (MCP23S17)
Thanks!
I tried your suggestion:
Code:
OutA=$FFFF 'Initial value for word var
OutA.0=0 'Bit mod - WORKS
OutA.2=0 'Another bit mod - WORKS OutA.0=0 'Bit mod - WORKS
OutA.8=0 'Another bit mod - WORKS
OutA.10=0 'Bit mod - WORKS
OutA.12=0 'Another bit mod - WORKS
OutA_hi=OutA.highbyte 'Splits into hibyte
OutA_lo=OutA.lowbyte 'And into low byte of the word var
OutA_MCPReg = OLATA 'Sets up PORTA output
OutA_DataOut=OutA_lo 'Sets up data to be pushed to the MCP23S17 as the low byte
gosub SEND_OutA_2317 'Send it
pause 10 'Wait a bit
OutA_MCPReg = OLATB 'Sets up PORTB output
OutA_DataOut=OutA_hi 'Sets up data to be pushed to the MCP23S17 as the hi byte
gosub SEND_OutA_2317 'Send it
And it works like a CHAMP!
However (you knew it might come) how do I resolve a single byte variable which tells me which bit to turn on/off into a word var?
My need for this home project, is to read a byte var and based on its value turn on/off a bit on the expander?
Example: Var=$C, so I need to turn on the 12th bit on the expander.
Regards,
Steve
"If we knew what we were doing, it wouldn't be called research"
- Albert Einstein
Bookmarks