This is a multi-part message in MIME format.
------=_NextPart_000_008B_01C095D2.7044C600
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_008C_01C095D2.7044C600"
------=_NextPart_001_008C_01C095D2.7044C600
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi could anyone tell me what=B4s wrong with my code??
I=B4ll explain=20
The lcd is wired up as follows:
Vdd driven by RA3
RS by RA2
RW by RA1
E by RA0
and RD0 to RD7 for the 8 data bits
The code compiles ok but the lcd just initializes and doesn=B4t write =
the world hello as I intend, it kind of resets or something...
the pic is running at 4MHZ and the LCD is a 16*4
Thanks in advance
------=_NextPart_001_008C_01C095D2.7044C600
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi could anyone tell me what=B4s =
wrong with my=20
code??
I=B4ll explain
The lcd is wired up as =
follows:
Vdd driven by RA3
RS by RA2
RW by RA1
E by RA0
and RD0 to RD7 for the 8 data =
bits
The code compiles ok but the lcd just =
initializes=20
and doesn=B4t write the world hello as I intend, it kind of resets or=20
something...
the pic is running at 4MHZ and the LCD =
is a=20
16*4
Thanks in advance
------=_NextPart_001_008C_01C095D2.7044C600--
------=_NextPart_000_008B_01C095D2.7044C600
Content-Type: application/octet-stream;
name="lcd3.asm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="lcd3.asm"
list p=3D16f877
include "p16f877.inc"
errorlevel 0, -302, -305
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _HS_OSC & =
_WRT_ENABLE_ON & _LVP_ON & _DEBUG_OFF & _CPD_OFF
;; comand modes
clr_display EQU 01h
curs_home EQU 02h
set_mode EQU 07h
display_on EQU 0Fh ; display On and blinking cursor
curser_shft EQU 1Ch
func_set EQU 38h ; set it to display 16 characters
temp EQU 22h
org 0x000
start
main
nop
call lcd_init
movlw display_on ; put the value 00001111 on register w
call lcd_com ; call the comand function
movlw func_set ; put the value 00111000 on register w
call lcd_com ; call the comand function
movlw B'01001000' ; put The letter 'H' on w
call lcd_data ; call data function
movlw B'01000101' ; put 'E' in w
call lcd_data ; call data function
movlw B'01001100' ; put 'L' in w
call lcd_data ; call data function
movlw B'01001100' ; put 'L' in w
call lcd_data ; call the data function
movlw B'01001111' ; put 'O' in w
call lcd_data ; call the data function
lcd_init
nop
bcf STATUS,5
clrf PORTB
clrf PORTD
bsf STATUS,5
movlw 00h ; set w to 00000000
movwf TRISD ; set port D as Output
movlw b'00000000' ; set w to 00000000
movwf TRISA ; set portA as output
bcf STATUS,5
return
lcd_com
nop
bsf PORTA,0 ; A0 high this is Enable in the LCD
bsf PORTA,2 ; A2 high This is RS in the LCD
bcf PORTA,1 ; A1 low This is R/W in the LCD
movwf PORTD ; put the value in w to Port D
bcf PORTA,0 ; set A0 to low
call lcd_delay ; call delay
bsf PORTA,0 ; set A0 to high
return
lcd_delay
nop
decfsz temp,F
goto lcd_delay
return
lcd_data
nop
bsf PORTA,2
bcf PORTA,1
movwf PORTD
bsf PORTA,0
call lcd_delay
bsf PORTA,0
end
------=_NextPart_000_008B_01C095D2.7044C600--
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.