USART Problem - code works with 16F88 but not 18F4520

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
ste5442
Flowcode V4 User
Posts: 16
Joined: Sun Sep 20, 2009 6:53 pm

USART Problem - code works with 16F88 but not 18F4520

Post by ste5442 »

Hi All,

I have discovered an issue with Flowcode and the way it deals with the USART on the 18F4520.
If i compile working RS232 code for the 16F88 and talk to Hyperterminal (TX and RX) everything is fine but when the chip is changed to an 18F4520 (and the jumpers are set accordingly etc etc) the code no longer works?
I have verified that the hardware is setup correctly with the 18F4520 and that it is receiving the transmitted characters correctly from Hyperterminal.
If someone from Matrix MM can shed some light on this issue it would be appreciated :-)

I have also read on this forum about other problems with USART setup on other chips - is there a big overhaul underway to resolve the issues?

Thank you!

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: USART Problem - code works with 16F88 but not 18F4520

Post by Benj »

Hello

On your 18F4520 device how are you checking that the characters have been received? Also are the characters being echoed back out to hyperterminal correctly as was the case with the 16F? What aspect of the program is not working correctly?

There are some chips that have advanced baud generation registers that Flowcode does not currently use but the current baud calculations should be more then fine running on these devices.

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: USART Problem - code works with 16F88 but not 18F4520

Post by Benj »

Hello

My guess is that this is a configuration problem, a baud or a clock speed problem.

Setting the chip configuration to something similar to the following should help to get you up and running. Please note that all settings that are not shown are set to disabled unless you specifically want to enable the write protection etc.
config.JPG
config.JPG (82.93 KiB) Viewed 3189 times
Also check that the clock speed is set correctly in the Project Options window to allow the baud rate to be calculated correctly. Once you have done this you may also have to go into the RS232 component properties and click OK to allow the new baud rate to be calculated correctly.

Let me know how you get on.

Post Reply