Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Lcd 16x2 initialization problem PIC16F88

Status
Not open for further replies.

hamradio

Newbie level 6
Joined
Jul 17, 2011
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,376
Hi to all of you! I'm sorry for reopening closed thread!
The problem which i want to solve is from my new project just the lcd part is buged :D
This is the datasheet of the display **broken link removed**

Project ASM file i'm new with C especially ASM


The problem is that every time i need to restart twice the rig to start corectly the display if i don't there is hieroglyphic view :D

Thank you in advance!
 

Attachments

  • project.rar
    7 KB · Views: 64

the controller is not getting reset properly... use some delay of 500msecs or so, before you send the initialization commands... send ox38 or 0x28 command 2 times....
 
This is just with cheaper lcd i think i'll try and post the result! Thank you for the fast response!
 

A friend rejected my request for help with this therefore i'm bagging for your help where and what to change acording to the previos posts solution!!! Thank you in advance!

LCD_Initialize
movlw b'00110000'
call LCD_SendByte
call wait100msec
movlw b'00110000'
call LCD_SendByte
call wait10msec
movlw b'00110000'
call LCD_SendByte


movlw b'00100000'
call LCD_SendByte

movlw b'00100000'
call LCD_SendByte
movlw b'10000000'
call LCD_SendByte

movlw b'00000000'
call LCD_SendByte
movlw b'10000000'
call LCD_SendByte

movlw b'00000000'
call LCD_SendByte
movlw b'00010000'
call LCD_SendByte

; movlw b'00100000'
; call LCD_SendByte
; call wait10msec

; movlw b'00100000'
; call LCD_SendByte
; movlw b'11100000'
; call LCD_SendByte

return

LCD_Clear
movlw b'00000000'
call LCD_SendByte
movlw b'00010000'
call LCD_SendByte
return

LCD_DisplayTurnOff
movlw b'00000000'
call LCD_SendByte
movlw b'10100000'
call LCD_SendByte
return

LCD_DisplayTurnOn
movlw b'00000000'
call LCD_SendByte
movlw b'11100000'
call LCD_SendByte
return

LCD_CursorTurnOn
movlw b'00000000'
call LCD_SendByte
movlw b'11100000'
call LCD_SendByte
return
LCD_CursorTurnOff
movlw b'00000000'
call LCD_SendByte
movlw b'11000000'
call LCD_SendByte
return
LCD_SendByte
movwf LCD_ByteSendBuffer
bsf LCD_P4
btfss LCD_ByteSendBuffer,4
bcf LCD_P4
bsf LCD_P5
btfss LCD_ByteSendBuffer,5
bcf LCD_P5
bsf LCD_P6
btfss LCD_ByteSendBuffer,6
bcf LCD_P6
bsf LCD_P7
btfss LCD_ByteSendBuffer,7
bcf LCD_P7
bsf LCDE

movlw d'60'
movwf WaitCounter
decfsz WaitCounter,f
goto $-1

bcf LCDE

movlw d'60'
movwf WaitCounter
decfsz WaitCounter,f
goto $-1


return
 

Your particular LCD uses the ST7066 controller, you code does not appear to incorporate the necessary delays to effectively initialize the controller.

Reference Sitronix ST7066 Dot Matrix LCD Controller/Driver Datasheet, pg 19, Initialization Routine 8-bit Interface:

Sitronix ST7066 Dot Matrix LCD Controller/Driver Datasheet



Upon briefing examining your code, there is not at least a 15ms delay to allow the power to settle and the controller to finish its power up cycle. You should also check to ensure there are correct delays between the first three instructions/inputs and following the insuance of the Function Set instruction either the Busy Flag must be monitored or a sufficient delay allowed before the next instruction is issued.

Code:
LCD_Initialize
movlw b'00110000'  [COLOR="#FF0000"]<- Need >15ms delay for issuing the first controller instruction/input[/COLOR]
call LCD_SendByte
call wait100msec   [COLOR="#FF0000"]<- Need >4.1ms delay for issuing the second controller instruction/input[/COLOR]
movlw b'00110000'
call LCD_SendByte
call wait10msec    [COLOR="#FF0000"]<- Need >100µs delay for issuing the third controller instruction/input[/COLOR]
movlw b'00110000'
call LCD_SendByte
                   [COLOR="#FF0000"]<- Need To Issue Function, Display Off, Display Clear, Entry Mode Set Instructions[/COLOR]

movlw b'00100000'
call LCD_SendByte

movlw b'00100000'
call LCD_SendByte
movlw b'10000000'
call LCD_SendByte

...
...
...

There are most likely other issues with your code, however solving your initialization routine will be a step in the right direction. Refer to the datasheet I have provided and post any additional problems you are having after correcting your code.

BigDog
 
Thank you for the fast reply!!!
I have one more question how to export the asm file from mp lab in hex format i found from where but i did it in wrong way maybe :-|
 

Thank you for the fast reply!!!
I have one more question how to export the asm file from mp lab in hex format i found from where but i did it in wrong way maybe :-|

When you run the assembler by building your project the HEX file is generated and can be located in the project directory along with the original ASM files.

Is this what you are referring to?
 
Is there any special with the compilation, specific options and etc.
 

Just make sure you have the correct PIC model selected under Configure->Select Device and Configuration Bits setting using either Configure->Configuration Bits or the Assembler Directive something like "__config _RC_OSC & _WDT_OFF & _PWRTE_ON" at the top of the ASM file. The particular settings are PIC model dependent, so you'll have to look them up if you going to use the Assembler Directive instead the MPLAB IDE.

You would probably benefit from a good PIC Programming Tutorial:

**broken link removed**

They are the best tutorials I've come across. They cover both the Baseline and Midrange PICs using both Assembler and Hi-Tech C Compiler. The source code for each lesson is downloadable as well. Best of all they are absolutely free.

Your PIC16F88 is considered a midrange device. You'll probably hit a snag or two, if so just post a description of your problem.

Study those tutorials, they will get you started in the right direction.

BigDog
 
You're G o d help!!! :cool::cool::cool: I'm very glad to have people like you!!! Thank you!
between this is very good project for soldering station! it's working but this is the last problem the lcd!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top