Page 1 of 1

PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 11:58 am
by darrynenig22
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

Re: PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 1:27 pm
by Benj
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)

Re: PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 1:52 pm
by stefan.erni
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..

LCD.PNG
(21.38 KiB) Downloaded 2500 times

Re: PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 2:52 pm
by Benj
These should be equivalent. Though let us know if not :D
$PORTF.2 = $PORTF0.2

Re: PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 3:01 pm
by darrynenig22
Hi

The test flowcode has the $PORTF0.2 defined as correct.

Re: PIC18F67K40 16x2 LCD Configure

Posted: Thu Sep 27, 2018 3:18 pm
by darrynenig22
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.

Re: PIC18F67K40 16x2 LCD Configure

Posted: Sun Sep 30, 2018 3:53 pm
by darrynenig22
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

Re: PIC18F67K40 16x2 LCD Configure

Posted: Mon Oct 01, 2018 1:15 pm
by Benj
Hello,

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);
}
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.

Code: Select all

__PROG_CONFIG(0x2, 0xE53D);
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?

Re: PIC18F67K40 16x2 LCD Configure

Posted: Wed Oct 03, 2018 1:34 pm
by darrynenig22
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

Re: PIC18F67K40 16x2 LCD Configure

Posted: Wed Oct 03, 2018 3:56 pm
by LeighM
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

Code: Select all

asm ("BSF NVMCON1, 7");

Re: PIC18F67K40 16x2 LCD Configure

Posted: Fri Oct 05, 2018 5:14 pm
by darrynenig22
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

Re: PIC18F67K40 16x2 LCD Configure

Posted: Mon Oct 08, 2018 11:07 am
by LeighM
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

Re: PIC18F67K40 16x2 LCD Configure

Posted: Fri Feb 01, 2019 2:31 pm
by darrynenig22
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