PDA

View Full Version : 16F677 lcd troubles



12aBridge
- 27th January 2010, 07:58
hello I have a standard parallel interface lcd that I have hooked up to a 16F677
and I cant get it to go ,I have never had trouble with these before ,I have tested the screen on a 16F84 and it works ,but will not work on the 677,
but the controls do work ,Ie I can turn on the blinking cursor and move it around on the screen ,but as soon as i send it a character it just goes blank
I have turned off all the hardware stuff I can find ,I have also move it around on the pic so its not a problem with one port specifically .I have it running on the internal clock ,but have tried it hooked up to a standard 4MHz crystal ,but it still does the same thing ,I have also tried defining the osc at 4MHz so the lcdout instruction knows how fast the internal osc is going but this made no difference
I am using microcode studio 2.2.1.1 and PBP2.47 I have a epic win programmer and are currently using the melabs beta driver for it
Any tips or suggestions would be greatly apreciated

mackrackit
- 27th January 2010, 09:55
If it works with one PIC and not the other on the same board then it must be a code/config problem.

Post your code and config settings from the inc file if you are not setting them in code.
Then maybe we can help.

12aBridge
- 3rd February 2010, 06:41
sorry this took a while to get back I have been busy lately
again any enlightenment would be great ,cause its got me beat .I should also mention its my first "project" with one of the newer pics with the internal clocks and what not,so it could be something quite obvious to you more experienced PIC'ers



INCLUDE "modedefs.bas"

@ device pic16F677, intrc_osc_noclkout

'DEFINES ------------------------------
OSCCON = %01100101 'set internal clock at 4MHZ
OSCTUNE = %00000
'OSCCON = %01101000
define OSC 4 'this makes no difference

trisb = %00000000
trisc = %00000000
WPUB = %00000000 'weak pullups on portB disabled
IOCB = %00000000 'interupt on change disabled
SSPCON.5 = 0 'SSPEN
CM1CON0 = %00000000 'comparaters disabled
CM2CON0 = %00000000
ANSEL = %00000000

'ADON = 0 'no ADC inabled

define LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 7
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 6
DEFINE LCD_BITS 4
define LCD_BITS 4
define LCD_LINES 1
define LCD_COMMANDUS 2000
define LCD_DATAUS 50

temp var byte

'start-------------------------------------
pause 500
temp = 104
lcdout $FE,$0E 'this works
pause 1500
lcdout $FE,$14 'this works
pause 1500
lcdout $FE,$80 'this works
pause 1500

Loop:


lcdout $FE,1
pause 700
lcdout $FE,1,"one" 'this doesnt work
pause 700
lcdout $FE,1
pause 700
lcdout $FE,2,"two" 'this doesnt work
pause 700
lcdout $FE,1
pause 700
LCDOUt $FE,#temp 'this doesnt work
pause 700

goto loop

end


thanks

Archangel
- 3rd February 2010, 07:45
Shot in the dark:
ANSELH = 0
and take out the extra define LCD_BITS 4

12aBridge
- 3rd February 2010, 09:07
wow I dont know how many times Ive looked through that code and never spotted I had that define twice, but that didnt work ,But clearing ANSELH did thanks so much ,I have no idea why that works though but its sure good to see text on that screen

thanks joe

Archangel
- 3rd February 2010, 16:59
I have no idea why that works though but its sure good to see text on that screen

Look at the data sheet section 4-4: There is a chart which shows ANS8:11 assignments (analog). I picked up this tidbit just last week, reading someone else's posts.

12aBridge
- 4th February 2010, 05:56
thanks joe ,Ive been through that data sheet over and over ,looking to turn off all the hardware stuff,completely missed that though. any ideas why the control commands worked,surely they would need the same data pins ,or have I missed something in the screens data sheet too....

thanks again

Archangel
- 4th February 2010, 06:27
any ideas why the control commands worked,surely they would need the same data pins ,or have I missed something in the screens data sheet too....


I am not sure which "control commands" you refer to . . . But some PBP statements do a whole lot of stuff behind the scenes. For instance the High / Low commands set tris registers on the fly and may well kill off some analog functions as well, I won't swear by that though.

Dave
- 4th February 2010, 12:04
12aBridge, What are you trying to accomplish with the statements:
lcdout $FE,1
pause 700
lcdout $FE,1,"one" 'this doesnt work
pause 700
lcdout $FE,1
pause 700
lcdout $FE,2,"two" 'this doesnt work
pause 700
lcdout $FE,1
pause 700
LCDOUt $FE,#temp 'this doesnt work
pause 700

The statement:lcdout $FE,1 will try to clear the display. Some display's require a small amount of time ~5 to 15 milliseconds before being able to receive data. You are sending the data string "one","two",and the ascii representation of the value in temp to the display before it has had a chance to execute the previous command of clear screen. After sending the clear screen command "$FE,$01" wait for about 10 milliseconds (pause 10) and see if that doesn't cure the problem... I normally wait for 100uS after I send any commands that require the use of the $FE command. especially the ones that change curcor position. If you read the data sheet for the display you are using these delays will be called out...

Dave Purola,
N8NTA