Problems with PIC18F46K22

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Visinto
Posts: 3
Joined: Tue Nov 04, 2014 7:48 pm
Location: Germany
Has thanked: 1 time
Been thanked: 1 time
Contact:

Problems with PIC18F46K22

Post by Visinto »

Hi @ all,

I have a bit trouble with my current flowcode Project. In this Project I want to read some variables from the PIC18F46K22´s internal EEPROM.
The first 25 EEPROM cells are inital values which are directely programmed to the MCU (I call these values the "Standard configuration").

During the first power up these "Standard configuration" should be read and written to other EEPROM cells (the "User configuration").
This seems to work. Because I checked the EEPROM cells after the first power up with my Galep III (I read out the data memory of the MCU).

This is what I get:
Image

But when I read one of these EEPROM cells (e.g. 46) I only get rubbish (I printed the Information to a 4x20 LCD). :(

This type of Controller is very new for me and by the way flowcode too...
I am not sure about the oscillator settings and other configuration (I want to use the internal oscillator with a frequency between 4 (preferable) and max. 16 MHz).

So please could someone of you help me with this problem(s)?

Thanks
Tobias
Attachments
SAMCSW2014_0v2.fcfx
(33.42 KiB) Downloaded 225 times
The only source of knowledge is experience.
Albert Einstein

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 PIC18F46K22

Post by medelec35 »

Hi Tobias,
From the sounds of it the data connection to LCD could be wrong or faulty connections.
Or
Clock speed is not correct, causing LCD corruption as all timing may be out?
One way do check is the 1HZ flasher.
If you have an LED + limiting resistor then o/p high to LED, delay 500ms, o/p low to LED delay 500ms repeat continuously.
Also using internal osc the maximum clock frequeny is 64MHz = internal osc set at 16MHz & PLL (x 4 multiplier) enabled.
You have got the clock frequency in options set for 16MHz yet the PLL is enabled!
Also you have osctune set at 0x40 which forces clock speed to run at a lower speed than calibrated clock speed.
You would be best removing osctune statement.
Before continuing it would be best to confirm all is running at the correct speed before looking at the LCD display.

Martin
Martin

Visinto
Posts: 3
Joined: Tue Nov 04, 2014 7:48 pm
Location: Germany
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC18F46K22

Post by Visinto »

Hi Martin,

thank you for your quickly answer and your ideas.

I have checked the connection to the LCD with an other MCU (PIC16F887). It works well.
The Pin configuration in Flowcode is also correct. So I think that this is not the problem.

After this I changed the program for the PIC18F46K22 and added the 1Hz LED flasher. I also removed the configuration of the osctune register and tested it.
Clock speed seems to be correct. The expected delay of 500ms appeared:

Image

Display on LCD is still faulty.

Do you have any other ideas, because I am helpless at this point.

Tobias
The only source of knowledge is experience.
Albert Einstein

Visinto
Posts: 3
Joined: Tue Nov 04, 2014 7:48 pm
Location: Germany
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Problems with PIC18F46K22

Post by Visinto »

Hey guys,

I am so happy right now - Not totally sure, but I think I found the problem! :D

The "Extended instruction set" (Bit 54 of the configuration) was enabled. Microchip says the following about this function in the datasheet:
"Enabling the PIC18 instruction set extension may cause legacy applications to behave erratically or fail entirely."

There are some things that you have to consider if you want to use this "instruction set extension". Probably this caused my described issues.
I'm going to check my complete program at the end of the week and let you know the results. :wink:

Tobias
The only source of knowledge is experience.
Albert Einstein

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 PIC18F46K22

Post by medelec35 »

Hi Tobias,
Visinto wrote:The "Extended instruction set" (Bit 54 of the configuration) was enabled.
Ah yes, well spotted!.
I can confirm that does cause issues with LCD, I had forgotten about that.

Martin
Martin

Post Reply