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.

need help on display problem

Status
Not open for further replies.

sixty9sandals

New Member
hi every body..
as a newbies, i need help n some advise from anyone who willing to help me..
im doing a temperature measurement project.. i try to display the result on three type of display which is a row of ten leds display, lcd and by pc.. the leds works just find but my lcd keep display black boxes ..im using pic 16f877 and 16X2 lcd..

my code as below..

DEFINE ADC_BITS 10 ' ADC PARAMETER
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

DEFINE LCD_DREG PORTD 'CONFIGURE LCD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 200

Define HSER_RCSTA 90h ' serial setting
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 2400
DEFINE HSER_SPBRG 25
Define HSER_CLROERR 1

MEASURED_VALUE VAR word ' declare variable


TRISA = %00000001
TRISB = %00000000
TRISC.0 = %0
TRISC.1 = %0
ADCON0 = %10000101
ADCON1 = %10000000

pause 500

START:

ADCIN 0 , MEASURED_VALUE ' DISPLAY ON LEDS
pause 100
PORTB= ~MEASURED_VALUE.LOWBYTE
pause 100
PORTC.0= ~MEASURED_VALUE.8
pause 100
PORTC.1= ~MEASURED_VALUE.9
pause 100



START2:

LCDOUT $FE,1 ' DISPLAY ON LCD
PAUSE 100
LCDOUT "VALUE: ", BIN MEASURED_VALUE.lowbyte
PAUSE 1000


START3:

HSEROUT [ BIN MEASURED_VALUE, 10] ' SEND TO PC
PAUSE 100
GOTO START
END


anybody willing to lend me an advice n teach me on how to solve it?..thank you
 
Last edited:
hi sixty,
After minor changes, to make your version of the basic code, compatible with mine, the program works fine in my OS PIC Simulator.

Outputs on the LCD and UART, values vary as ADC inputs vary.

The usual problems with the HD44870 controller is that its slow, requires delays, especially during initialise.

LCD_INITMS = ???

What Basic are you using?
 
hi eric..

im using a microcode studio pic basic pro..
ive put some value of LCD_INITMS = 500..but unlucky for me..the screen now display only one row of black box..ive try to change the value of screen contrast..still..either wont display anything or black box..beside..i also ve try a fix value of contrast by either conect it directly to the ground or to the vdd..still ..the same result..or..is that anything wrong with my code?any suggestion for better code?n one more thing..ive a doubt on DEFINE LCD_DBIT..if im using all portD for the data line which is 8bits use in total..is it right by wrinting DEFINE LCD_DBIT 0?

thank you
 
hi sixty,
For the contrast, you require a 10K0 variable resistor [Pot], connect the one end of the resistor to +5V and the other end to 0V, the wiper goes to VO, which is pin 3 on my version on the LCD. Adjust the Pot to that you can just see the LCD pixel blocks.

I have a Proton Lite[ demo version] I'll give at go, let you know.

My project board is wired for PORTB as 8 data and PORTE as control, so I'll need to reconfigure.
 
hi sixty,
Compiled your source using Micro [Lite], had to chop off, the ADC section.
The Lite version is limited to 20 lines of code!.

The *.hex file runs OK in my PIC Sim, drives the LCD.

I'll program a PIC tomorrow.
 
hi sixty,
Run into a problem, the Micro compiler 'assembler' listing is not directly compatible with my MPLAB assembler.
I use the MPLAB programmer function to program my PIC's.

The attached reduced version of your source code, runs OK on my OS PIC Sim.

Try it out, it just displays "VALUE" on the LCD.

Did you fit the 10K pot to the LCD contrast?
 
Last edited:
ericgibbs said:
hi sixty,
Run into a problem, the Micro compiler 'assembler' listing is not directly compatible with my MPLAB assembler.
I use the MPLAB programmer function to program my PIC's.

The attached reduced version of your source code, runs OK on my OS PIC Sim.

Try it out, it just displays "VALUE" on the LCD.

Did you fit the 10K pot to the LCD contrast?

hi eric..
thanks for giving a shot..ive fit the 10k pot..but..unlucky for me it still display black box...now i realy screwed..even your attached code did display the same thing..black box..looking at the previous tread send by others..it make me think, is that possibly coz by using the pot d as the data line?
 
hi,
Do you a have circuit showing how you have connected the LCD/PIC, is it a HD44870 controller.?

The LCD pcb pinouts do vary for different modules.

Is anything coming out of the UART, when using your program?
 
ericgibbs said:
hi,
Do you a have circuit showing how you have connected the LCD/PIC, is it a HD44870 controller.?

The LCD pcb pinouts do vary for different modules.

Is anything coming out of the UART, when using your program?

hi..
for the controler i think it is ks0066..and i refer to the schematic in the little green book..
 

Attachments

  • VCM1602A.pdf
    107.9 KB · Views: 187
sixty9sandals said:
hi..
for the controler i think it is ks0066..and i refer to the schematic in the little green book..

Checking your pdf against the HD44780/LCD pcb shows the same pin configuration.

If I send you the 'valueonly.hex' file, do you have the facility to program a 16F877 using this hex file.?
 
I have the same problem with an 20 * 4 LCD

there are 2 lines (1 and 3) that are full with black boxes

i've tried everything
 
Piccer said:
I have the same problem with an 20 * 4 LCD

there are 2 lines (1 and 3) that are full with black boxes

i've tried everything

There are various types of 4 line displays, some are simply a pair of two line displays, on alternate lines, and you select which display to use. It sounds like you're only accessing one of the displays? - you need to study the datasheet for your particular display.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top