PIC18F67K40 16x2 LCD Configure
Moderator: Benj
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
PIC18F67K40 16x2 LCD Configure
Hi Everyone,
I needed to upgrade to the PIC18F67K40 but have some problems with the LCD 16x2 not working. led's and switches are working.
I have a development relay board that has a PIC16F1947 16x2 Controller HD44780 LCD, switches and led's that has worked for a number of years so the hardware is proved to be working. the component v5 LCD is working with flowcode V8 and code loads successfully from MPLAB X with Pickit3 programmer
I have created a small test flowcode and changed multiple configure chip settings and clock speeds to find the problem, This was also tested with the PIC16F1947 to ensure hardware was not the issue.
I'm sure this something to do with with the config of the pic or internal clock, Any help would be appreciated.
Test flowcode file attached
Thanks
I needed to upgrade to the PIC18F67K40 but have some problems with the LCD 16x2 not working. led's and switches are working.
I have a development relay board that has a PIC16F1947 16x2 Controller HD44780 LCD, switches and led's that has worked for a number of years so the hardware is proved to be working. the component v5 LCD is working with flowcode V8 and code loads successfully from MPLAB X with Pickit3 programmer
I have created a small test flowcode and changed multiple configure chip settings and clock speeds to find the problem, This was also tested with the PIC16F1947 to ensure hardware was not the issue.
I'm sure this something to do with with the config of the pic or internal clock, Any help would be appreciated.
Test flowcode file attached
Thanks
- Attachments
-
- PIC18F67K40 Internal Osc LCD 16X2 Test.fcfx
- (11.72 KiB) Downloaded 265 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hello,
Your project looks ok to me, I can't seem to spot anything that might cause a problem.
Is the LCD wired up as shown here?
https://www.matrixtsl.com/wiki/index.ph ... hanumeric)
Your project looks ok to me, I can't seem to spot anything that might cause a problem.
Is the LCD wired up as shown here?
https://www.matrixtsl.com/wiki/index.ph ... hanumeric)
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 654
- Joined: Fri Aug 19, 2016 2:09 pm
- Location: switzerland
- Has thanked: 182 times
- Been thanked: 179 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi
Just a small help. Check if the pin make a problem. Is $PORTF.2 = $PORTF0.2
If not click and set it new
The Led looks ok..
Just a small help. Check if the pin make a problem. Is $PORTF.2 = $PORTF0.2
If not click and set it new
The Led looks ok..
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
These should be equivalent. Though let us know if not
![Very Happy :D](./images/smilies/icon_biggrin.gif)
$PORTF.2 = $PORTF0.2
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi
LCD is wired in the same way with 4 bit operation.
Pin A2 wired to the backlight, This LCD works in the hardware with PIC16F1947 has the same test code to prove the hardware is good.
Interesting if I test the LCD 16x2 in a full busy flowcode program with interrupts, DS18B20 and timers the LCD has some life with
numbers are shown, Numerical and custom characters are working but a large part of the
information sent to the display is not shown, Its not corrupted data just missing the characters and showing only some of the numerical data.
The printstrings that are written to the LCD seem to have a problem I think.
The code continues to work with switches and led's behaving as they should.
LCD is wired in the same way with 4 bit operation.
Pin A2 wired to the backlight, This LCD works in the hardware with PIC16F1947 has the same test code to prove the hardware is good.
Interesting if I test the LCD 16x2 in a full busy flowcode program with interrupts, DS18B20 and timers the LCD has some life with
numbers are shown, Numerical and custom characters are working but a large part of the
information sent to the display is not shown, Its not corrupted data just missing the characters and showing only some of the numerical data.
The printstrings that are written to the LCD seem to have a problem I think.
The code continues to work with switches and led's behaving as they should.
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi,
I have identified that the printstring to my LCD 16x2 is not working for the PIC18F67K40. Have checked that the XINST is disabled in chip configure.
The Test flowcode prints the numerical value and counts up at 1 sec intervals ,but the printstring text is not visible.
I have tried different configure settings to try and solve this without success.
Any help to resolve this would be appreciated.
Thanks
I have identified that the printstring to my LCD 16x2 is not working for the PIC18F67K40. Have checked that the XINST is disabled in chip configure.
The Test flowcode prints the numerical value and counts up at 1 sec intervals ,but the printstring text is not visible.
I have tried different configure settings to try and solve this without success.
Any help to resolve this would be appreciated.
Thanks
- Attachments
-
- PIC18F67K40 Internal Osc LCD 16x2 Printstring Test .fcfx
- (12.3 KiB) Downloaded 247 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hello,
The PrintNumber function converts the numeric value to a string and then prints the string, so it's interesting that this is working.
Maybe try printing a string variable rather than a constant. It could be that constants have a problem? The LCD component is one of our corner stones that is known to work very well so I'm guessing it's something to do with the chip.
StrVar = "Hello World"
Print (StrVar)
Another thing you can try is a constant string of numbers
Print ("1234")
If this works then it could be one of your data pins at fault?
The Extended instruction configuration setting can cause String related problems. This is disabled in the config options and the value passed to the C code looks ok.
Can you do a read back of the hex file on the chip and confirm that bit 15 of CONFIG2 is set. (Bit 7 of CONFIG2H). Maybe something is creeping in to the config settings using the PICkit and MPLAB and clearing the XINST bit?
The PrintNumber function converts the numeric value to a string and then prints the string, so it's interesting that this is working.
Code: Select all
void FCD_04071_v5__lcddisplay0__PrintNumber(MX_SINT16 FCL_NUMBER)
{
MX_CHAR FCL_S[FCLsz_S];
FCI_TOSTRING(FCL_NUMBER, FCL_S,10);
FCD_04071_v5__lcddisplay0__PrintString(FCL_S, FCLsz_S);
}
StrVar = "Hello World"
Print (StrVar)
Another thing you can try is a constant string of numbers
Print ("1234")
If this works then it could be one of your data pins at fault?
The Extended instruction configuration setting can cause String related problems. This is disabled in the config options and the value passed to the C code looks ok.
Code: Select all
__PROG_CONFIG(0x2, 0xE53D);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi Benj
The 16x2 has always worked on a number of my PIC16F chips and simple to set up V8 V6 and V5 flowcode Im stumped with this PIC18F
I have tested your suggestions and everything looks ok.
Have tried to print as a string var and print string as numbers but nothing shows on the 16x2 , Printnumber and Print ascii is working.
The readback configure from the chip shows XINST is set as disable, MPLAB file attached.
Attached flowcode has a number of tests to try to solve the problem. Firstly changed the OSC to 4000000 hz and power up timer enabled and changed the component to LCD_16x2
Working:
Print number works ok
Ramwrite a bar graph from left to right is working ok
PriuntAscii, sequence through the Ascii set is working ok
Not working:
Printstring "HELLO VISIBLE" at any cursor position on the 16x2 nothing displayed
Also printstring over the bar graph blocks, no blank blocks or text "HELLO" showing.
Is there anything else I can do to solve this.
Thanks
The 16x2 has always worked on a number of my PIC16F chips and simple to set up V8 V6 and V5 flowcode Im stumped with this PIC18F
I have tested your suggestions and everything looks ok.
Have tried to print as a string var and print string as numbers but nothing shows on the 16x2 , Printnumber and Print ascii is working.
The readback configure from the chip shows XINST is set as disable, MPLAB file attached.
Attached flowcode has a number of tests to try to solve the problem. Firstly changed the OSC to 4000000 hz and power up timer enabled and changed the component to LCD_16x2
Working:
Print number works ok
Ramwrite a bar graph from left to right is working ok
PriuntAscii, sequence through the Ascii set is working ok
Not working:
Printstring "HELLO VISIBLE" at any cursor position on the 16x2 nothing displayed
Also printstring over the bar graph blocks, no blank blocks or text "HELLO" showing.
Is there anything else I can do to solve this.
Thanks
- Attachments
-
- MPLAB configuration bits.txt
- (10.96 KiB) Downloaded 225 times
-
- PIC18F67K40 16x2 LCD printstring.fcfx
- (21.06 KiB) Downloaded 250 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Looks like this could be due a silicon error, see page 4 ..
http://ww1.microchip.com/downloads/en/D ... 00715D.pdf
Could you try this C code at the start of the program
http://ww1.microchip.com/downloads/en/D ... 00715D.pdf
Could you try this C code at the start of the program
Code: Select all
asm ("BSF NVMCON1, 7");
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi Benj,
Thanks, This did solve the problem but may have created another.
asm ("BSF NVMCON1, 7");
Im using the PIC18F67K40 Device ID Revision = a002
The text was displayed on the LCD and working ok, But now I add eeprom component and the text is not displayed. If I disable the eeprom component the text is displayed.
This is the same for tests with one wire component. falure to show text if the one wire component is added into the flowcode. shows text if removed.
Any suggestions, Thanks
Thanks, This did solve the problem but may have created another.
asm ("BSF NVMCON1, 7");
Im using the PIC18F67K40 Device ID Revision = a002
The text was displayed on the LCD and working ok, But now I add eeprom component and the text is not displayed. If I disable the eeprom component the text is displayed.
This is the same for tests with one wire component. falure to show text if the one wire component is added into the flowcode. shows text if removed.
Any suggestions, Thanks
- Attachments
-
- PIC18F67K40 16x2 LCD printstring + eeprom.fcfx
- (12.61 KiB) Downloaded 191 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Hi,
Could you try the attached CAL EEPROM file, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC
Hopefully this will fix the display when the EEPROM component is present.
Thanks,
Leigh
Could you try the attached CAL EEPROM file, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC
Hopefully this will fix the display when the EEPROM component is present.
Thanks,
Leigh
- Attachments
-
- PIC_CAL_EEPROM.c
- (5.55 KiB) Downloaded 143 times
-
- Posts: 11
- Joined: Mon Oct 06, 2014 12:55 pm
- Location: Somerset, UK
- Been thanked: 1 time
- Contact:
Re: PIC18F67K40 16x2 LCD Configure
Thanks leigh and team,
Just an update, I have bailed on this PIC18F67K40 as the errata was to severe.
Have flipped to the PIC18F66K22 and everything is working as expected.
Thanks to all
Just an update, I have bailed on this PIC18F67K40 as the errata was to severe.
Have flipped to the PIC18F66K22 and everything is working as expected.
Thanks to all