Hi Henrik,
Yes, NOT GATE or inverted output, here's a Wiki link for any other newbies:
http://en.wikipedia.org/wiki/Inverter_(logic_gate)
Like I said in my post above, it's easy to jump to the wrong conclusions(that's why I appreciate your and mackrackit's help so much)
Speaking of help, I blew the dust of the old LCD and ran a modified program from mackrackits link:
Code:
MyVAR VAR BYTE
Mybyte var byte
Mybit VAR bit
LET MyByte = 7
For MyVar = 0 to 7
MyBit = MyByte.0(MyVar)
LCDOut $FE,1,"Bit ",#MyVar,"=",#MyBit
Pause 2000
Next MyVar
When I ran it, Bits 0-1-2 were 1's the rest 0's following the pattern for Bin 7
. So onto Bruce's code below:
Code:
' Only DAT_OUT bits 1 and 2 are used. We add a few 1's in bit
' positions 0,3,5,7 to balance out the data packet being sent.
DAT_OUT = %10101001
' Get data on button inputs & invert 0's to 1's
DAT_OUT.0[1]=~GPIO.3
DAT_OUT.0[2]=~GPIO.4
INTCON.0 = 0 ' Clear int on change flag
' Build checksum of 2 data bytes
CHK_SUM = (DAT_OUT * 2)
Well the checksum would be two BYTES of:
Code:
DAT_OUT = %10101001
With bits 1 & 2 being 0's (not inverted).....I think.
Code:
DAT_OUT = %10101001 DAT_OUT.0[1]=~GPIO.3 DAT_OUT.0[2]=~GPIO.4
Would mean (I think again) bit 1 & 2 would invert to a 1 in the DAT_OUT_BYTE. Or saying that maybe it's only bits 1 & 2 that are inverted and sent. Mm, not sure but I'll go with the first option.
Tin hat on, duck, am I close? (if not, just say so and I'll carry on thinking / reading).
Dave
Bookmarks