I already decoded it as 0x31, 0x0d, 0x0a (at 150 Baud N,8,1). That's what print 1 or print L is expected to send. (I used BASIC 35 years ago).It's difficult to interpret the scope waveform.
That means you are probably younger than me!(I used BASIC 35 years ago).
Yes, you can try that.
Here is the test code which I made. My code still doesn't use interrupts for receiving serial data. It uses polling method. The lcd code in my code is working only in Bascom AVR simulator. It is not working in Proteus. I have not tested the codes on hardware. I am new to Bascom AVR.
Transmitter.
[/code]
$regfile = "m16def.dat"
$crystal = 4000000
$Baud = 9600
$sim
$lib "lcd4.lbx" ' use the alternative library
$hwstack = 40
$swstack = 40
$framesize = 40
'in order for simulation to work correct, you need to specify the used pins
'for lcd4.lbx, the pins are fixed
'Rs = PortB.0
'RW = PortB.1 we dont use the R/W option of the LCD in this version so connect to ground
' E = PortB.2
'E2 = PortB.3 optional for lcd with 2 chips
'Db4 = PortB.4 the data bits must be in a nibble to save code
'Db5 = PortB.5
'Db6 = PortB.6
'Db7 = PortB.7
Config Lcdpin = Pin , Rs = Portb.0 , E = Portb.2 , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7
Waitms 200
Config Lcd = 16x2
Dim count as byte
DDRB = $FF
PORTB = $00
Cls
Locate 1 , 1 : Lcd "ATmega"
Waitms 50
Locate 1 , 7 : Lcd 16
Waitms 50
Locate 1 , 10 : Lcd 4
Waitms 50
Locate 1 , 11 : Lcd "M"
Waitms 50
Locate 1 , 12 : Lcd "H"
Waitms 50
Locate 1 , 13 : Lcd "z"
Waitms 50
count = 255
Do
Print str(count)
Print $0D
Print $0A
Waitms 1000
count = count + 1
Locate 2 , 8 : Lcd str(count)
Loop
End
$regfile = "m16def.dat"
$crystal = 4000000
$Baud = 9600
$sim
$lib "lcd4.lbx" ' use the alternative library
$hwstack = 40
$swstack = 40
$framesize = 40
'in order for simulation to work correct, you need to specify the used pins
'for lcd4.lbx, the pins are fixed
'Rs = PortB.0
'RW = PortB.1 we dont use the R/W option of the LCD in this version so connect to ground
' E = PortB.2
'E2 = PortB.3 optional for lcd with 2 chips
'Db4 = PortB.4 the data bits must be in a nibble to save code
'Db5 = PortB.5
'Db6 = PortB.6
'Db7 = PortB.7
Config Lcdpin = Pin , Rs = Portb.0 , E = Portb.2 , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7
Config Serialin = Buffered , Size = 20
Config Lcd = 16x2
Dim uart_rd(4) as byte
Dim I as Integer
Cls
Locate 1 , 1 : Lcd "ATmega"
Locate 1 , 7 : Lcd 16
Locate 1 , 10 : Lcd 4
Locate 1 , 11 : Lcd "M"
Locate 1 , 12 : Lcd "H"
Locate 1 , 13 : Lcd "z"
Enable Interrupts
Do
If Ischarwaiting() = 1 Then 'was there a char?
uart_rd(I) = Ischarwaiting()
If uart_rd(I) = $0D or uart_rd(I) = $0A Then
I = 0
Else
I = I + 1
End If
uart_rd(I) = 0
EndIf
Locate 2 , 1 : Lcd uart_rd
Loop
End
Which Compiler used ? Bascom AVR ? If BASCOM AVR then I can help.
I am new to Bascom AVR.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?