Pic18f46j50 problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Pic18f46j50 problem

Post by Desdewit »

Hi Guys

Could this be a compiler error?
When I compile my rtcc test program to a pic18f25j50 the usb to serial sends the data to my pc as expected but when I compile to pic18f46j50 the data send to my pc is different and mixed around. :?
Attachments
SimPLC RTCC V1.0a.fcf
(16.35 KiB) Downloaded 251 times

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Pic18f46j50 problem

Post by Kenrix2 »

Try loading the 18F46j50 with the hex file generated from your 18F25j50 project (since that one works) and see if it now works correctly. If it does work, then take a close look at the changes you made in your 18F46j50 project versus the 18F25j50 project.

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Re: Pic18f46j50 problem

Post by Desdewit »

Hi Kenrix


Thanks for the reply.
I found that there is a clock speed difference even though both pics are using the same 8Mhz crystal & same rtcc crystal.
I also found that for some reason even when I remove the 8Mhz crystal the program keeps on running like nothing has changed.
Please have a look at the way I setup my config and rtcc timer to make sure there are no conflict.

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Pic18f46j50 problem

Post by Kenrix2 »

Thanks for posting your discovery Desdewit. It turns out that the configuration address in the .fcd files for this entire family needs to be edited. The configuration addresses can be found in table 6.1 in the device data sheet. Please find the line containing "ConfigAddress=" in the .fcd file for these chips and change the value according to the data sheet table. For example, in the PIC18F46j50 .fcd file the line should read ConfigAddress=0xFFF8 (save the change and restart Flowcode).

As for checking your rtcc timer, I have never worked with the rtcc and I also don't use 18F devices so I can't help with that.

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Program run only when powered from usb

Post by Desdewit »

Hi Kenrix2

After changing the ConfigAddress I’ve noticed some other problems.
When my board is powered by usb only the first ASCII string send to LCD “Starting” display correct but the second ASCII string display as “PULLILE” instead of “running”
When powered from normal 12V power supply the program does not even start-up.
:x :x :x :x :x :x :x :x :x
Attachments
SimPLC RTCC V1.0a.fcf
(18.16 KiB) Downloaded 252 times

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Pic18f46j50 problem

Post by Kenrix2 »

There are no configuration bits in your program, I wish I could help you in setting them but 18F devices are a mystery to me.

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: Pic18f46j50 problem

Post by Benj »

Hello,

If you disable the assembler code you have to setup the RTCC then does the "Running" string appear correctly? Could be something to do with the RTCC code or the interrupts. String corruption on an 18F is normally associated with extended CPU config setting but your config has this setting disabled already.

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Re: Pic18f46j50 problem

Post by Desdewit »

Hi Benj

Sorry for the late reply.

I found that when I disable the RTCC Output Enable bit "bsf_rtccfg, RTCOE" the display is Ok.
The only other problem I found is that the program run +/- 200ms slower according to my test led on port D5 when I unplug the usb to serial cable.
Does not matter what Mhz crystal I put in the led speed stays the same.

Post Reply