PDA

View Full Version : LCD & defaults



trying
- 9th May 2006, 15:40
in the PBP man it states. "it assumes the LCD will be used with 4 bit bus with data lines DB4-DB7 connected to PICmicro MCU PORTA.0-PORTA.3 Register Seclect to porta.4 and enable to PORTB.3" And shows a weak pull up added to PORTA.4
my ? is this does it also set up the I/O for this and is PORTA.4 used as a input.
I will be using a 16f630 that has a programmable weak pull up for PORTA.4
can I use the programmable pullup by adding my normal
CMCON = 7 'PORTA ALL DIGITAL
VRCON = 0 'VOLTAGE REF. DISABLE
TRISA = %00001100 'MAKE A.3 &.4 INPUTS
TRISC = %00000000 'MAKE ALL PORTC OUTPUTS

OPTION_REG.7 = 0 'ENABLE WEEK PULLUPS (CLEAR RAPU)
WPUA = %00010000 'WEAK PULLUP ON PORTA.4

thanks

Bruce
- 9th May 2006, 16:05
You could use the internal pull-up, but it shouldn't be necessary if the pin is
bi-directional.

The example in your PBP manual uses a pull-up on RA4 of the PIC16F84 only
because this pin is an open drain type output, and can only provide ground to
the LCD RS pin.

Look on the MeLabs site for the LAB-X4 examples. They have schematics &
sample code for creating a serial LCD driver with a PIC16F676.

mat janssen
- 9th May 2006, 17:39
You said TRISA = %00001100 'MAKE A.3 &.4 INPUTS
but if you look good then you made A.2 and A.3 an input and A.4 is stil in the register an output.

trying
- 9th May 2006, 17:48
thanks
even when you cut and paste make sure what you cut is what you need
typos are killing me

trying
- 11th May 2006, 15:29
Well after alittle help here and some port changes its working
thanks

@ DEVICE pic16f630
@ DEVICE pic16f630, INTRC_OSC_NOCLKOUT
@ DEVICE pic16f630, WDT_ON
@ DEVICE pic16f630, MCLR_OFF 'TEST LCD
@ DEVICE pic16f630, CPD_OFF ' 16F630
@ DEVICE pic16f630, BOD_OFF '
@ DEVICE pic16f630, PWRT_ON
@ DEVICE pic16f630, PROTECT_OFF
DEFINE OSC 4
Pause 10000 ' Allow pic to Stabilize

CMCON = 7 'COMPARATOR OFF
VRCON = 0 'VOLTAGE REF. DISABLE
TRISA = %00001000 'MAKE PORTA OUTPUTS(.3 MUST BE INPUT)
TRISC = %00000000 'MAKE ALL PORTC OUTPUTS
SYMBOL LED= PORTA.5 'POWER UP LED
LED=0

DEFINE CHAR_PACING 1000
DEFINE LCD_DREG PORTC ' Set LCD Data PORTC
DEFINE LCD_DBIT 0 ' Set starting Data BIT (0 OR 4) IF 4-BIT bus
DEFINE LCD_RSREG PORTC ' Set LCD Register Select PORTC
DEFINE LCD_RSBIT 5 ' Set LCD Register Select BIT PORTC
DEFINE LCD_EREG PORTC ' Set LCD Enable PORTC
DEFINE LCD_EBIT 4 ' Set LCD Enable BIT PORTC.3
DEFINE LCD_BITS 4 ' Set LCD bus size (4 OR 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines ON LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set Data delay time in us

LED=1
Pause 350 'POWER OK
LED=0



Pause 2000

LCDOut $FE,1,"IT MUST BE" 'CLEAR SCREEN 'PRINT, "IT MUST BE"

LCDOut $FE,$C0,"WORKING" '2ND. LINE PRINT "WORKING"

End