Hi !
I have acquired a AVR-MT-128 from OLIMEX and the Codevision code works fine.
Even though I like C I would like to use BASCOM AVR as well but so far had no success with the LCD. Other tests such as the Relay and buzzer have worked fine.
The following is a translation of the C code com Olimex example that I ported to BASCOM. The LCD pin assignment have been made correctly but nothing shows up on the LCD.
’ ###########################################
’ Start here
’ ###########################################
Const Disp_on = &B00001100
Const Disp_off = &B00001000
Const Clr_disp = &B00000001
Const Cur_home = &B00000010
Const Dd_ram_addr = &B10000000
Declare Sub _e
Declare Sub Lcdinit
Declare Sub Buzzer
Declare Sub Lcdsendchar(byref Sendc As String)
Declare Sub Lcdsendcmd(sendcmd As Byte)
Dim Lcddata As Byte
Sub _e
Portc.2 = 1
Waitms 1
Portc.2 = 0
End Sub
Sub Lcdinit
Portc.0 = 0
Waitms 110
Portc = &B00110000
_e
Waitms 10
Portc = &B00110000
_e
Waitms 10
Portc = &B00110000
_e
Waitms 10
Portc = &B00100000
_e
End Sub
Sub Buzzer
Do
Porte.4 = 0
Porte.5 = 1
Waitms 1
Porte.5 = 0
Porte.4 = 1
Loop Until Porta.3 = 0
End Sub
Sub Lcdsendchar(byref Sendc As String * 1)
Waitms 2
Lcddata = Val(sendc) And &B11110000
Portc = Portc And &B00001111
Portc = Portc Or Lcddata
Portc.0 = 1
_e
Lcddata = Val(sendc) And &B00001111
Portc = Portc And &B11110000
Portc = Portc Or Lcddata
Portc.0 = 1
_e
End Sub
Sub Lcdsendcmd(sendcmd As Byte)
Waitms 2
Lcddata = Val(sendcmd) And &B11110000
Portc = Portc And &B00001111
Portc = Portc Or Lcddata
Portc.0 = 0
_e
Lcddata = Val(sendcmd) And &B00001111
Portc = Portc And &B11110000
Portc = Portc Or Lcddata
Portc.0 = 0
_e
End Sub
Dim Cmd As Byte
Dim I As Byte
Dim Temp As String * 1
Dim Lcd_message As String * 32
Cmd = Disp_on
Call Lcdsendcmd(cmd)
Waitms 10
Cmd = Clr_disp
Call Lcdsendcmd(cmd)
Waitms 10
Cmd = Dd_ram_addr
Call Lcdsendcmd(cmd)
Lcd_message = “TESTE 123”
I = Len(lcd_message)
Do
Temp = Mid(Lcd_message,i,1)
Call Lcdsendchar(temp )
I = I - 1
Loop Until I = 0
Cmd = Dd_ram_addr
Call Lcdsendcmd(cmd)
End
’ ###########################################
’ End here
’ ###########################################
Notice that I have not used in the internal Bascom LCD routines, they wont work at all.
Did anyone had the experience of using BASCOM Avr with this Olimex board ?
Thanks,
Max