Re: Port alias in Port Expanders (MCP23S17)
OK, it is working!
Thanks to all who helped and provided some food for thought.....
Code below for any others who need to do this:
Code:
OutA=$FFFF 'Initial value for word var - everything is OFF
PortDevice=$A 'Var from comm link
OutA.0[PortDevice]=0 'This works!
' OutA.2=0 'Manual bit mod - works though
' OutA.12=0 'Manual bit mod - works though
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
Happy New Year!
-Steve
"If we knew what we were doing, it wouldn't be called research"
- Albert Einstein
Bookmarks