Arvo' All,
What i thought would be a walk in the park took me three long nights to get working. So here is my code to save others a few hours.
8M2 driving a Digole serial driver board. The LCD is a 16x2.
The Digole boards always start up at 9600,8,n,1.
The 8M2 can do 9600 on the Hardware serial port when its clock is bumped up to 8 meg but i don't think there will be much time left to do other things.
I got the demo working at B9600_8 then put in a gear change back to B2400_4 so the 8M2 Hserout and the Digole both end up running at 2400.
Let me know via this thread if something is not clear .
What i thought would be a walk in the park took me three long nights to get working. So here is my code to save others a few hours.
8M2 driving a Digole serial driver board. The LCD is a 16x2.
The Digole boards always start up at 9600,8,n,1.
The 8M2 can do 9600 on the Hardware serial port when its clock is bumped up to 8 meg but i don't think there will be much time left to do other things.
I got the demo working at B9600_8 then put in a gear change back to B2400_4 so the 8M2 Hserout and the Digole both end up running at 2400.
Let me know via this thread if something is not clear .
Code:
' Headers by Jeff Pethybridge Aug 2013
'
' _-_0_1_2_
' | |
' ) 8M2 |
' |_________|
' + 5 4 3
'
'C5 = (AXE027 Serial Out) '
'C4 = Sw1 to +ve '
'C3 = Sw2 to +ve '
'C2 = NC '
'C1 = NC '
'C0 = (AXE027 serial Out) / Digole-RX 9600
;Symbols: Byte Word Bits
{
symbol VarA = b0 ' bit7 : bit6 : bit5 : bit4 : bit3 : bit2 : bit1 : bit0
symbol VarB = b1 'w0 bit15: bit14: bit13: bit12: bit11: bit10: bit9 : bit8
symbol VarC = b2 ' bit23: bit22: bit21: bit20: bit19: bit18: bit17: bit16
symbol VarD = b3 'w1 bit31: bit30: bit29: bit28: bit27: bit26: bit25: bit24
symbol VarE = b4 '
symbol VarF = b5 'w2
symbol VarG = b6 '
symbol VarH = b7 'w3
symbol VarI = b14 '
symbol VarJ = b15 'w4
symbol VarK = b16 '
symbol VarL = b17 'w5
symbol VarM = b18 '
symbol VarN = b19 'w6
symbol VarO = b20 '
symbol VarP = b21 'w7
symbol VarQ = b22 '
symbol VarR = b23 'w8
symbol VarS = b24 '
symbol VarT = b25 'w10
symbol Timer = time
' Hardware aliases
'symbol ??? = c.1
'symbol ??? = c.2
'symbol sw1 = pinc.4
'symbol sw2 = pinc.3
}
' pins = x : x : x : pin4 : pin3 : pin2 : pin1 : x
'
' dirs = x : x : x : dir4 : x : dir2 : dir1 : x
'
dirsC = %00000100
' Initialise serial and Digole Serial HD44780 LCD board.
' Digole always boots up at 9600, N,8,1.
' 9600 is about as fast as an 8m2 can go.
' So start the 8m2 at 9600_8, init Digole to 2400
' then slam the 8m2 back to 4 meg, then set hserial down to 2400.
' This should divide the work needed by the M2 by 4 leaving time for other tasks.
hsersetup B9600_8,%00 ' Hardware serial port to 9600 @ 8meg, non inverted.
setfreq m8 ' 8M2 to 8 meg clock.
pause 3000 ' Pause 3 sec to read the Digole startup text.
hserout 0,("CL") ' CLear LCD.
hserout 0,("SB2400") ' Set Baud rate of Digole to 2400.
pause 100 ' We need time to change gears !
setfreq m4 ' 8M2 clock to 4 meg.
hsersetup B2400_4,%00 ' Hardware serial port now 2400 @ 4 meg , non inverted.
hserout 0,("TP",0,0) ' Sets next character location 0,0 ( line 1 , character 1).
hserout 0,("TT","Now 2400 Baud",0,10,13) ' "Now 2400 Baud" on LCD .
Pause 2000
hserout 0,("TP",0,1) ' 0= Character 1 , 1= line 2
hserout 0,("TT","* <-CHR 0,line 2",0,10,13) ' text on LCD
pause 2000
hserout 0,("TP",0,0) ' next text will start from character 1, line 1.
hserout 0,("TT"," ",0,10,13) ' 14 spaces to clear line 1.
hserout 0,("TP",6,0) ' next text will start from character 7, line 1
hserout 0,("TT","* <-C7,L1",0,10,13) ' text on LCD.
stop
' "Memory used = 192 bytes out of 2048"
end
Attachments
-
2.7 KB Views: 31
Last edited: