Steve2381
Senior Member
Hey all
I have bit comms working with my Oled screen using the code below you kindly showed me
I don't understand the bit0,bit1,bit2 etc - but hey... its works! It is sending the contents of b0 to the display as required.
I need it to send the contents of b4.... if that makes sense (LookUp bPtr, ( $33, $32, $28,$0C, $06, $01 ), b4 : Gosub SendInitCmdByte).
If I simply put b4 at the end of the Lookup statement, it doesn't work.
Brainy people required!
Edit... OK. I understand that bit0-bit7 are the contents of b0. So how do you access the 'bit' contents of b4?
I have bit comms working with my Oled screen using the code below you kindly showed me
Code:
#Picaxe 40x2
#No_Data
setfreq m8
Symbol pinE = pinb.7 : Symbol dirE = dirb.7 ; 0 = Idle 1 = Active
Symbol pinRS = pinb.5 : Symbol dirRS = dirb.5 ; 0 = Command 1 = Data
Symbol pinD4 = pinb.6 : Symbol dirD4 = dirb.6 ; LCD Data Line 4
Symbol pinD5 = pinc.5 : Symbol dirD5 = dirc.5 ; LCD Data Line 5
Symbol pinD6 = pinc.4 : Symbol dirD6 = dirc.4 ; LCD Data Line 6
Symbol pinD7 = pinB.1 : Symbol dirD7 = dirB.1 ; LCD Data Line 7
PowerOnReset:
Gosub InitialiseLcd
Displayline1:
b0 = $80 : Gosub SendCmdByte 'Move to start of line 1
For bPtr = 0 To 19
LookUp bPtr, ( "Line number 1 " ), b0 : Gosub SendDataByte
Next
stop
InitialiseLcd:
dirE = 1 ; Set LCD control lines as outputs
dirRS = 1
dirD4 = 1
dirD5 = 1
dirD6 = 1
dirD7 = 1
For bPtr = 0 To 5
LookUp bPtr, ( $33, $32, $28,$0C, $06, $01 ), b0 : Gosub SendInitCmdByte
Next
Return
SendInitCmdByte:
Pause 15 ; Delay 15mS
SendCmdByte:
pinRS = 0 ; Send to Command register
SendDataByte:
pinD7 = bit7 ; Put MSB out first
pinD6 = bit6
pinD5 = bit5
pinD4 = bit4
pinE = 1 ; Give a pulse on E
pinE = 0
pinD7 = bit3 ; Put LSB out second
pinD6 = bit2
pinD5 = bit1
pinD4 = bit0
pinE = 1 ; Give a pulse on E
pinE = 0
pinRS = 1 ; Send to Data register next
Return
I need it to send the contents of b4.... if that makes sense (LookUp bPtr, ( $33, $32, $28,$0C, $06, $01 ), b4 : Gosub SendInitCmdByte).
If I simply put b4 at the end of the Lookup statement, it doesn't work.
Brainy people required!
Edit... OK. I understand that bit0-bit7 are the contents of b0. So how do you access the 'bit' contents of b4?
Last edited: