**Hi I am trying to interface a 16x2 alphanumeric lcd to a 16f877a but am having no success ,the hardware works with a different hex file loaded into pic and I can write to the port I have lcd connected to to light up LED 's, I am using a modified version of one of GCB example files.
Pic chip is using 20mhz Xtal osc.
Also using command line under ubuntu
linux.
This is the version and date of GCB I have installed Version: 0.98.01 2017-10-27
follows is part of source code.
#chip 16F877a, 20
#config BODEN = OFF, PWRTE = ON, WDT = OFF
;Setup LCD Parameters
#define LCD_IO 8
;#define LCD_NO_RW
#define LCD_SPEED SLOW
; ----- Define Hardware settings
#define LCD_RS PORTA.5
#define lcd_RW PORTA.4
#define LCD_Enable PORTA.3
#define LCD_DATA_PORT PORTD
; ----- Main body of program commences here.
Do Forever
CLS
WAIT 3 s
PRINT "START TEST"
locate 1,0
PRINT "DISPLAY ON"
wait 3 s
Hi attached are the hex and asm files I'm having difficulty with and also hex that works with hardware setup, I no longer have source code for it . It was something I was playing with a few years ago possibly written in JAL. but not sure .
Hi thanks very much for your help with this much appreciated, yes old hex is definately for this chip and have test with a leds connected to port and all works......... I am using a prototype board that is hard wired to the display port 99% sure lcd is 8 bit, but they are
several years old model " PVC160202PGN" maybe I should get a new one to try,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can download the attached file. Replace the existing library in the ..\GCB@Syn\GreatCowBasic\Include\lowlevel directory. I have changed the init timings to (maybe) better support older LCDs.
Just to confirm. I have validated this program on real hardware. Only difference is the ports - my board is hard coded. :-)
#chip 16F877a, 20
#config BODEN = OFF, PWRTE = ON, WDT = OFF
;Setup LCD Parameters#define LCD_IO 8
#define LCD_SPEED SLOW
; ----- Define Hardware settings#define LCD_RW PORTE.1
#define LCD_RS PORTE.0
#define LCD_Enable PORTE.2
#define LCD_DATA_PORT PORTD
; ----- Main body of program commences here.
Do Forever
CLS
WAIT 3 s
PRINT "START TEST"
locate 1,0
PRINT "DISPLAY ON"
wait 3 S
loop
Hi still no good ........ each bit on portD has a led attached when I run oldhex file they blink away but when I load lcd8-877a.hex there is no activity the chip oscillator is running and the top line of the LCD is 16 full blocks, also did a search for lcd.h and appart form the GCB there is several other files called lcd.h..... no sure if this has any relavance. I will go to the local electronics store in the morning and buy a new lcd and see if that makes any difference tho the one I have works with oldhex file.
Geoff.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
File photo. We only have one lcd.h relative to Great Cow BASIC. So, no worries there.
File is not correct. Will not load. There format is one I have never seen before with respect to having two lines of data on one one line.
Try 4-bit. Please.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have tried the 4 bit mode still no go have programmed a 16f887 and bread boarded circuit but still no go I can write to portd and count with led's attached but no go with lcd program there is no activity on data pins monitored with led's . this is the command line I am using " gcbasic /A:GCASM lcd8-887.gcb"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have was originally using a 16f877a on a hardwired prototyping board but last try was using a 16f887 using breadboard but still with same result. I wonder if it is to do with using linux?.
Attached is zip file.
Hugh and I have looked at this. The original HEX is not valid 'The working hex is weird, all the addresses and line sizes are wrong'. I cannot get this operate on a chip, in a PICKit or MPLAB.
Can you please a detailed photo of the back on the LCD?
**Hi I am trying to interface a 16x2 alphanumeric lcd to a 16f877a but am having no success ,the hardware works with a different hex file loaded into pic and I can write to the port I have lcd connected to to light up LED 's, I am using a modified version of one of GCB example files.
Pic chip is using 20mhz Xtal osc.
Also using command line under ubuntu
linux.
This is the version and date of GCB I have installed Version: 0.98.01 2017-10-27
follows is part of source code.
ETC
Any help appreciated.
Geoff
Last edit: Geoff Wrightson 2018-04-26
This code works here.
Remove LCD_RW and try LCD_NO_RW
post the completed project including the hex, and, the other hex... what source was that? attach this hex.
just tried on a simulator. also works.
Last edit: Anobium 2018-04-26
Hi attached are the hex and asm files I'm having difficulty with and also hex that works with hardware setup, I no longer have source code for it . It was something I was playing with a few years ago possibly written in JAL. but not sure .
I am not certain the old hex is for that chip. Are you 100% certain?
Also, do you know if the LCD is a 4 bit or 8 bit LCD?
Can you take a photo of the back?
Does the chip run? If you connect just an LED via a suitable resistor - and you turn the LED of and off with a small delay. Does the LED flash?
A photo of your setup/rig/board would also help.
I can deasm the HEX and this may shed some light on the old HEX.
I am asking questions like these as we must have 1000's of solutions with LCDs and I do not expect any issues with the library or core LCD functions.
Hi thanks very much for your help with this much appreciated, yes old hex is definately for this chip and have test with a leds connected to port and all works......... I am using a prototype board that is hard wired to the display port 99% sure lcd is 8 bit, but they are
several years old model " PVC160202PGN" maybe I should get a new one to try,
Not really sure of the issue here.
Can download the attached file. Replace the existing library in the ..\GCB@Syn\GreatCowBasic\Include\lowlevel directory. I have changed the init timings to (maybe) better support older LCDs.
Just to confirm. I have validated this program on real hardware. Only difference is the ports - my board is hard coded. :-)
Last edit: Anobium 2018-04-26
Hi still no good ........ each bit on portD has a led attached when I run oldhex file they blink away but when I load lcd8-877a.hex there is no activity the chip oscillator is running and the top line of the LCD is 16 full blocks, also did a search for lcd.h and appart form the GCB there is several other files called lcd.h..... no sure if this has any relavance. I will go to the local electronics store in the morning and buy a new lcd and see if that makes any difference tho the one I have works with oldhex file.
Geoff.
Can you try the 4-bit LCD? But, are you 100% certain about this port assignments? Try the code below but check the port assignments.
Not sure where you are finding those other LCD.H files - a screen shot would help.
And, I cannot load the oldhex into... a simulator, Pk2, pk3 or MPLAB. Errors all the time.
File has no Config in pk2&pk2, MPLAB states the checksum is incorrect and the file in the emulator is meaningless. So.... how are you programming?
I have removed the UNIX file format to get the file even to load.
Last edit: Anobium 2018-04-27
Hi just tried hex file again "oldf877a.hex" and it works ok , programmed pic using linux program "picprog" I have attached hex again .
Hi attached is screenshot of lcd.h file locations .
Thank you.
File photo. We only have one lcd.h relative to Great Cow BASIC. So, no worries there.
File is not correct. Will not load. There format is one I have never seen before with respect to having two lines of data on one one line.
Try 4-bit. Please.
Have tried the 4 bit mode still no go have programmed a 16f887 and bread boarded circuit but still no go I can write to portd and count with led's attached but no go with lcd program there is no activity on data pins monitored with led's . this is the command line I am using " gcbasic /A:GCASM lcd8-887.gcb"
command line looks ok. Send me this whole project in a zip. Let us compare what is being generated.
I have never seen anything like this - every. Most odd.
just noticed... are you using a 877a or an 877? Last post stated 877.
I have was originally using a 16f877a on a hardwired prototyping board but last try was using a 16f887 using breadboard but still with same result. I wonder if it is to do with using linux?.
Attached is zip file.
Nothing obvious.
change to... guessing your oscillator.
Hugh and I have looked at this. The original HEX is not valid 'The working hex is weird, all the addresses and line sizes are wrong'. I cannot get this operate on a chip, in a PICKit or MPLAB.
Can you please a detailed photo of the back on the LCD?
Try this
Evan
Hi have attached a few photos and will try config line.
Geoff
config line made no difference
checked pulses with cro rs = 6ms low pulse, e = 2ms high pulse; data pulses 2ms.
geoff
I can confirm this code works. I have built a standalone test rig on a breadboard. i have tested with a number of LCDs all work.
My guess. Is your board missing a 10k pull-up on MCLR.
Last edit: Anobium 2018-04-28
I recognise(ish) your board. It is based in the PIC40 board. Should work.
I cannot datasheet on LCD. Must be old. This could be a timing issue or protocol issue - flying blind without a datasheet.
Hi attached code works tho only displays 1 character .
Geoff.
What is different from previous attempts? I would be guessing.