PDA

View Full Version : Lcdout



docwisdom
- 10th February 2006, 17:18
Hello everyone,
I currently have this code running on my 16F737 and all I am getting is a blinking cursor in character position 1. Any thoughts? I have the chip wired up as discribed in the PBP manual in the LCDOUT subsection. My only changes are the LCD bit locations as shown by the modified DEFINEs.

thanks


TRISB = %00000000

define OSC 4

DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0)

DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit

DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 5 ' Set LCD Enable bit

DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 1 ' 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

main:
High portc.4 'power indicator
pause 1000 '1 second delay
LCDOUT $FE, 1, "Hello" 'lcd readout
end

Bruce
- 10th February 2006, 21:38
The 16f737 has an A/D module, and on some of the RB pins are analog inputs.

Look in the 16F737 data sheet under the "ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE" section for the value to place in ADCON1 that allows these pins to function as digital I/O-pins.

Then you place ADCON1 = x in your code, (where x = the value shown in the data sheet) to turn off the A/D function for pins associated with the A/D module.

On power-up ADCON1 = %00000000 and this makes all pins (associated with the A/D module) analog inputs by default. You just need to change this to configure whatever pins you need as analog or digital.

docwisdom
- 11th February 2006, 01:39
Bruce you are way too cool. Thanks.
I knew it had to be something I wasnt thinking of. I have read through these datasheets, but for a beginner, there are a lot of terms in there that just plain dont make sense, so until someone points it out as a problem, it just doesnt click.

A lot of people on the forum say to just look in the datasheet, your answer is there. But somtimes it does take the extra explaination that you gave to really help.


---
along the same note, I am using a 16x1 display. In the manual it states that 16x1's are usually treated as 8x2's. When I try to write something longer than 8 characters it doesnt work. So I tried jumping to line two to continue the word and it still doesnt respond. Do I need to be running in 8bit mode to use all 16 characters? Here is the code

LCDOUT $FE, 1, "L.E.A.D.", $FE, $C0, "S."





cheers!