Problems with PIC16F1939 and LCD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Lieuwe
Posts: 16
Joined: Fri Aug 21, 2009 1:56 pm
Location: Holland
Has thanked: 1 time
Contact:

Problems with PIC16F1939 and LCD

Post by Lieuwe »

Hello,

First let me mention that the new version of Flowcode is great.
The low cost rf component is very nice, also the new supported devices.
Especially the PIC16F1xx ones.

However I have some problems with those 16F1xx ones.
It is not driving the LCD display.

Used target PIC16F1939, used LCD ANAG Vision, Conrad order no 181 657.

Symptoms:

Using the PIC16F887 everything works.
Pressing the button stops the LED from flashing, and the display shows the message.

Using the PIC16F1939 the LED flashes like it should, pressing the button does stop the LED, like it should, but the display keeps displaying 2 rows of all segments lit. As it does when it gets no data at all.

Could it be that there is something wrong with the targed definition files,
of the PIC16F1XX ones?
I tried also the PIC18F4620 with the same results as the PIC16F887, those older ones work, as expected.

I have attached the FCD files and the display data sheet.

Lieuwe

Display_16F887.fcf
(7.5 KiB) Downloaded 271 times
Display_16F1939.fcf
(7.5 KiB) Downloaded 270 times
187275-da-01-en-LCD_Modul_20x4_Zeichen_LED.pdf
(236.92 KiB) Downloaded 276 times

User avatar
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: Problems with PIC16F1939 and LCD

Post by Benj »

Hello,

I've had a look and can't find any real differences between the devices. The 16f19xx device has a comparator, cap touch and a LCD driver on Port D but these are all switched off by default.

Have you got a scope or some thing similar you can use to check if the digital outputs are toggling on and off correctly. You could do this with LEDs if you do not have access to a scope.

Lieuwe
Posts: 16
Joined: Fri Aug 21, 2009 1:56 pm
Location: Holland
Has thanked: 1 time
Contact:

Re: Problems with PIC16F1939 and LCD

Post by Lieuwe »

Benj,

Good advice, sometimes I struggle so much with the software, that I forget to have a look at the hardware!
I am able to get text on the same hardware using C programming, with Hitech and Source boost, but not with Flowcode 4.5 (for this device PIC16F1939, as mentioned before others like PIC16F887 work).
But in a short time I can borrow a Logic16 (saleae) analyser so I Can tell more about the signals to the display.
When I know, ill post it here.

Lieuwe

Lieuwe
Posts: 16
Joined: Fri Aug 21, 2009 1:56 pm
Location: Holland
Has thanked: 1 time
Contact:

Re: Problems with PIC16F1939 and LCD

Post by Lieuwe »

Hello again,

To keep things simple and to the point.
Forget about special displays etc.

In this example I use only 3 standard Eblocks:

1. EB006 USB multi-programmer.
2. EB004 LED board connected between PORTD and Display
3. EB005 LCD Board connected to LED board on PORTD

Further do I use 2 different PIC controllers:
the good old PIC16F877A and the New PIC16F1939 one.

I use Flowcode version 4.5.18.74 with the included Sourceboost compiler.
Only the PIC_EEPROM.c is updated, but I think that does not make any difference in this case.

I use two identical flowcharts, only the chosen PIC is different.

I start with the PIC16F877A, after the compile to chip process I see:

Text on the display alternating between line 1 and 2.
Led D7 and D6 are OFF.
Led D5 and D3 are mostly OFF, but with small glitches to ON.
Led D4,D2,D1 and D0 are mostly ON, but with small glitches to OFF.

This is how it should work, everything OK!

But..............................................................................................

I switch off the power supply to reset the display and, I replace the PIC to the new PIC16F1939:

after compile to chip I see:

A flashing cursor on the display position (0,0) but no text.
Led D7 and D6 are OFF.
Led D5 and D4 mostly OFF, but with small glitches to ON.
Led D3,D2,D1 and D0 mostly OFF but with extremely small glitches to ON.

This is not how it should work.

Well ill hope using standard Eblocks in this example will help to reproduce the problem.
Also converting to standard Eblocks helped to bypass the measurement problems a have in my custom application.
Its difficult to get to the display connections.

With a few Eblocks you can get the same results, I never thought a simple led Eblock can be used as an very simplistic channel analyser. (but it can)

I Hope that this will help to solve the problems with the PIC16F1xxx devices.

Used software files:
Display_16F877A.fcf
(5.5 KiB) Downloaded 281 times
Display_16F1939.fcf
(5.5 KiB) Downloaded 270 times
Lieuwe

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Problems with PIC16F1939 and LCD

Post by medelec35 »

I have a suggestion to try.
before the start of main loop and LCD start macro, make an o/p go high for a couple of seconds,then back low. Have an LED connected to that o/p
Because its before the start of main loop, LED will go high every time your chip resets. You will need to put WDT on and select auto clear watchdog in the project options.
I had an issue with 16F1824 and 16F1827 kept resetting, and that mystery still stands today. is the new types of chip, or is it Flowcode. with my situation not a clue.
Not sure if LCD routines will time cause time out or not, but you can always extend watchdog time out to a couple of seconds.

Just a thought.


martin
Martin

Lieuwe
Posts: 16
Joined: Fri Aug 21, 2009 1:56 pm
Location: Holland
Has thanked: 1 time
Contact:

Re: Problems with PIC16F1939 and LCD

Post by Lieuwe »

Hello Martin,

About using an I/O before the main loop is a good suggestion.
I also toggle an I/O in the main loop to check if the PIC is running, and how fast it is running.

The display still does NOT work, when you use PIC16F1939, while it does work when you use PIC16f887.
With the same hardware, E block programmer-board, with LED board and LCD on PortD.
But the LED's do show that both PIC do run (same speed), and that both PIC do not go into reset.
DisplayPic16F887.fcf
(7.5 KiB) Downloaded 269 times
DisplayPic16F1939.fcf
(7.5 KiB) Downloaded 259 times
Lieuwe

Post Reply