Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

204A LCD Problem, need help

Status
Not open for further replies.

kenji

New Member
Hello guys im a newbie on PICC and PIC. I'm working on a project that will display text on a 204A LCD. I'm using PIC16f877a microcontroller and Hi-tech compiler. The design is to make use of PORTA RA0:RA2 as controller for the LCD (RS,RW,E respectively), using PORTB RB4:RB7 as 4bit data interface.

I already set 0x06 to ADCON1 as this is what it takes to make PORTA digital output but still it didn't work. Did I missed something aside from the ADCON1 setting? Thank you so much.
 
Did you setup TRISA register to OUTPUT? Each bit in TRISA registers defines direction of PORTA, if you clear the TRISA,7 bit, it will set PORTA,7 to OUTPUT...
 
Thanks for the reply Jay, I setup TRISA to 0, presumably to set PORTA to output. I got this code running when using PORTB RB0:2 as LCD controls and PORTC RC4:7 as data. Seems it won't work using PORTA RA0:2 as LCD control and PORTB RB4:7.
 
It should work, try this
Code:
EXAMPLE 4-1: INITIALIZING PORTA

BCF STATUS, RP0 ;
BCF STATUS, RP1 ; Bank0
CLRF PORTA ; Initialize PORTA by
; clearing output
; data latches
BSF STATUS, RP0 ; Select Bank 1
MOVLW 0x06 ; Configure all pins
MOVWF ADCON1 ; as digital inputs
MOVLW 0xCF ; Value used to
; initialize data
; direction
MOVWF TRISA ; Set RA<3:0> as inputs
; RA<5:4> as outputs
; TRISA<7:6>are always
; read as '0'.
 
Hello All
Will the code above set PortA to digital. Seems like I read some
where that this port needed to be set for digital I/O, else it defaults
to analog.

Just a thought
Gordon
 
Oops, never mind, I forgot the ADCON1 sets the digital/analog.
Sorry for any inconvience.

Gordon
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top