I am using Hippy's code to run a 20x2 LCD from port B on a 28x2 port B.3-B.7
I also use want to use pins B.0 and B.1. as outputs
When using the 18x I can use (using PinsB here)
This doesn't seem to work using port B. Writing to the LCD seems to work in the simulator but alters the state of B.0 and B.1
Is there another way of getting this to work.
Murray
I also use want to use pins B.0 and B.1. as outputs
When using the 18x I can use (using PinsB here)
Code:
symbol RS = B.2 '0 = Command 1 = Data Register
symbol En = B.3 '0 = Idle 1 = Enable
symbol DByte = b1 'Data Byte for LCD
symbol RSbit = b2 'Data/Command Mask
symbol RSDATmask = %00000100 'Select LCD Data register
symbol RSCMDmask = %00000000 'Select LCD Command register
SendCmdByte:
peek $30,RSbit 'Recover OutB.0 and OutB.1
RSbit = RSbit & %11 'Send to Command register
goto SendCmdOrDataByte
SendDataByte:
peek $30 ,RSBit 'Recover OutB.0 and OutB.1
RSBit = RSBit & %11 | RSDATmask 'Send to Data register
SendCmdOrDataByte:
pinsB = DByte & %11110000 | RSbit 'Put MSB out first
pulsout En,1 'Give a 10uS pulse on Enable
pinsB = DByte * %00010000 | RSbit 'Put LSB out second
pulsout En,1 'Give a 10uS pulse on Enable
return
Is there another way of getting this to work.
Murray
Last edited: