if at the top of code before define add the follow code
it's okCode:pause 2000 @ reset
if at the top of code before define add the follow code
it's okCode:pause 2000 @ reset
Hi,
please try this:
' Set LCD Data port
DEFINE LCD_DREG PORTB
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTB
' Set LCD Register Select bit
DEFINE LCD_RSBIT 1
' Set LCD Enable port
DEFINE LCD_EREG PORTB
' Set LCD Enable bit
DEFINE LCD_EBIT 0
' Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
' Set number of lines on LCD
DEFINE LCD_LINES 2
pause 100
lcdout $fe,1,"Hello"
end
LCD Connection
Pin1=Vss: connect to ground
Pin2=Vdd: connect to Vcc=5V
Pin3=Vo: connect to middle pin of the POT(20K) to control brightness
Pin4=RS(register select): connect to micro pins that specify in the software(RB1)
Pin5=RW(Read/Write): connect to ground because we want to only write
Pin6=E(Enable): connect to micro pin that specify in the software(RB0)
Pin7 to 10: No connection
Pin 11 to 14: connect to RB4 to RB7
Pin15: connect to Vcc with a resistor(100 or 200 ohm resistor is good)
Pin16: connect to ground.
pin 16 and pin 16 are for backlights
the other two pins of pot should connect to VCC and ground and you should connect the MCLR with a 4.7K or 10K resistor to the VCC.
if your problem is not solve with this program you have another problem in other parts.
thank you for answer , but i have make the circuit on pcb and i can't make changes
be sure you set LVP to OFF, BOD to ON, PWRT to ON in your config fuses.
I doesn't do magic, but it help in most cases.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Paul's Theory - It sure sounds like to me that during the 0-3 second period after you turn off the power (and before you turn it on again), the power supply voltage drops low enough to reset the pic but not low enough to reset the LCD. After 4 seconds off, I am guessing the voltage decays enough to reset the processor AND the LCD - the LCD might be in the brown area until 4 seconds passes. You can:
1)Use a scope to measure the voltage after you turn off the power and see what it does.
2)Reset the LCD in software as partially described earlier in the week here
http://www.picbasic.co.uk/forum/showthread.php?t=4851
3)Change your power supply so that the voltage decays faster when the power is removed.
4) Board change – move the power for the LCD (not backlight if you have one) to an open pin on the PIC and control it there. (I know your board is does but ... if you need to make a change later)
Oh, I am guessing it is japanese you are seeing and not chinesethe LCD show chinese- most controllers have japanese as a second set of data characters built in.
Just my 2 cents worth
Paul Borgmeier
Salt Lake City, UT
USA
__________________
chinese or japanese, it's greek to me![]()
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks