shakespeare
New Member
The image below shows the character set defined in Part 1's code. It is possible by manipulating the definitions a bit more to achieve some alpha characters as well, although some will be hard to distinguish, such as I and 1. W and M look a bit scruffy in this size.
Where this unit could be handy is as a display of 5 analog inputs - 4 "minor" values on one side in normal font and one "major" one in "Bignum" font
View attachment 10089
Here is the basic circuit diagram of my current setup. R4 is there because I was originally using an 18A, which requires a resistor to hold the reset pin high. The 18A can run the code in Part 1, but you don't have a lot of program space for making good use of the unit when you use the big font.
View attachment 10088
Finally, here is code for the same unit to run a count from 0000 to 9999 repeatedly:
Where this unit could be handy is as a display of 5 analog inputs - 4 "minor" values on one side in normal font and one "major" one in "Bignum" font
View attachment 10089
Here is the basic circuit diagram of my current setup. R4 is there because I was originally using an 18A, which requires a resistor to hold the reset pin high. The 18A can run the code in Part 1, but you don't have a lot of program space for making good use of the unit when you use the big font.
View attachment 10088
Finally, here is code for the same unit to run a count from 0000 to 9999 repeatedly:
Code:
symbol e=5symbol rs=4
symbol bbit=3
symbol lbit=2
symbol twoline=8
symbol scroncron=14
symbol clr=3
symbol redled=7
symbol redpb=pin0
symbol whtpb=pin7
symbol yelpb=pin2
symbol tbout=6
symbol serpin=6
symbol char=b2
symbol index=b3
symbol Line1=0
symbol Line2=64
symbol Line3=20
symbol Line4=84
symbol SetDDRam=128
symbol ShiftLeft=24
symbol ShiftRight=30
symbol bnum=b4
symbol defidx=b5
symbol numadr=b6
symbol bchr=b7
symbol tnumadr=b8
symbol cpos=b9
symbol coff=b10
symbol idx2=b11
symbol total=b12
symbol wtotal=b13
symbol windex=w8
symbol wstore=w9
'Initialise IO
dirsb=%11111111
dirsc=%00001000
'Initialise display unit
init:
let pins = 0 'Clear all output lines
pause 200 'Wait 200 ms for LCD to reset.
let pins = bbit 'Set to 8-bit operation
pulsout e,1
pause 10 'Wait 10 ms
pulsout e,1 'Send data again
pulsout e,1
let pins = lbit 'Set to 4-bit operation.
pulsout e,1
pulsout e,1 'Send data again.
let pins = twoline 'Set to two line operation
pulsout e,1
let char = scroncron 'Screen on, cursor on instruction
gosub wrins
char=clr
gosub wrins
start: 'set cursor flag to line 1 col 1
cpos=146
setfreq m32
'Define CG0 to 7:
eeprom (31,31,0,0,0,0,0,0)
eeprom (0,0,0,0,0,0,31,31)
eeprom (24,24,24,24,24,24,24,24)
eeprom (3,3,3,3,3,3,3,3)
eeprom (3,7,14,28,24,24,24,24)
eeprom (24,28,14,7,3,3,3,3)
eeprom (24,24,24,24,28,14,7,3)
eeprom (3,3,3,3,7,14,28,24)
char=64
gosub wrins
for index=0 to 63
read index,char
gosub wrchr
next
'Go back to DDRam
char=cpos
gosub wrins
'Define bignum data 0 to 9
eeprom (86,52,52,120) '0
eeprom (3,3,3,3) '1
eeprom (86,8,80,114) '2
eeprom (86,8,6,120) '3
eeprom (52,120,4,4) '4
eeprom (81,112,6,120) '5
eeprom (86,48,86,120) '6
eeprom (22,4,4,4) '7
eeprom (86,120,86,120) '8
eeprom (86,120,4,120) '9
'display title
char=128
gosub wrins
eeprom 200,("BIG COUNT ")
for index=200 to 211
read index, char
gosub wrchr
next
'Display a count from 000 to 9999
main:
for windex=0 to 9999
wstore=windex
for idx2=1 to 4
wtotal=wstore % 10 'Mod to get least significant digit
wstore=wstore/10 'Div to shift digits down 1 decimal place
bnum=wtotal
gosub wrbig
next
pause 8000 'Pause 1 second to get approx 1Hz count at m32
cpos=146 'Put cursor in line 1, second last column, ready for next print
char=cpos
gosub wrins
next
goto main 'loop
wrchr:
if char<255 then skipconvspc
char=32
skipconvspc:
gosub wrbyte 'Send High nibble and set up low nibble
high rs 'Make sure RS is high
pulsout e,1 'Pulse enable pin to send data.
return
wrins:
gosub wrbyte 'Send High nibble and set up low nibble
pulsout e,1 'Pulse enable pin to send data.
return
wrbyte:
let pins = char/16 'High nibble of char to outputs 0 to 3
pulsout e,1 'Pulse the enable pin to send data.
let pins = char & 15 'Low nibble of char to outputs 0 to 3
return
wrbig: 'find start of definintion for 'bnum'
numadr=bnum*4+64
'write char out
for defidx=0 to 3
tnumadr=numadr+defidx
read tnumadr,bchr 'read byte with next two halves of the line
char=bchr/16-1 'write high nibble as CG
gosub wrchr
char=bchr & 15-1 'write low nibble as CG
gosub wrchr
lookup defidx,(64,20,84,0),coff
char=cpos+coff
gosub wrins
next
'restore to next position in line 1
cpos=cpos-3
char=cpos
gosub wrins
return
Attachments
-
35.1 KB Views: 323
-
17.1 KB Views: 202