Pic18F4550 RS232 sending a string

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
Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Pic18F4550 RS232 sending a string

Post by Errol »

The program below will not send a simple string from the 18F4550 to a terminal program.
I have tried several way to send a string but no output. The program has a simple in/output routine for RS232 that works just fine
I have transfer the program to a 16F88 and it send the string and echo's just fine.
What am I missing??
Attachments
18f4550 simple rs232.fcf
(6 KiB) Downloaded 355 times

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: Pic18F4550 RS232 sending a string

Post by medelec35 »

Hi Errol,
Not had a chance to test Flowchart on hardware, so don't know If attached file will work or not?
You could do the toggle a pin at 1HZ test to check hardware and configuration settings.

Can you let us know how you get on.

Thanks

Martin
Attachments
18f4550 simple rs232_1.fcf
(8 KiB) Downloaded 344 times
Martin

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by Errol »

Hi Martin
I was unable to load your modified Flowcode program, was it created in Flowcode 5? I'm running Flowcode 4.5.
I have setup a led to toggle at a 1 sec rate so I know the program is running. The simple echo does work.
Best regard
Errol

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by JohnCrow »

Hi Errol

Ive just had a quick look at the program Martin posted and tried to copy it to FC4 for you.
Not sure if I may have missed anything though.
18f4550 simple rs232-FC4.fcf
(6 KiB) Downloaded 370 times
1 in 10 people understand binary, the other one doesn't !

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by Errol »

Thank John
I think the one you posted is the one I posted. Martins has an _1 and mine does not.
Cheers
Errol

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: Pic18F4550 RS232 sending a string

Post by medelec35 »

Hi Errol
Errol wrote:Hi Martin
I was unable to load your modified Flowcode program, was it created in Flowcode 5? I'm running Flowcode 4.5.
Errol
Sorry, I have been using V5 a lot recently so just naturally used it to alter settings.
I was in a rush. :(
The Flowchart John posted looks like it is correct
I have got a 18F4455 and have not got a 4MHz xtal.
After configuring to 4MHz internal oscillator (adding osscon = 0x60; )
etc your program is running ok for me with hyperterminal and RS232 Eblock
The keys are echoing on the screen
Can you state if you are using a 4MHz crystal or not, and what pins of microcontroller have you got RX and TX of RS232 connected to?

Thanks John for posting a V4 version.

Martin
Martin

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by Errol »

Hi Martin
First I'm using pins 25/26 standard rs232 pins, I'm using a 4Mhz crystal. I decided to switch to an 16F877A on the same proto-type board,
the program works like it should.
I have a 18F2550 proto-type board that I will try tomarrow. But right now I think there is a bug with the complyer.
Have checked the C code (compared the 18f4550 and 16F877A) and can not find anything wrong.
I do not have a 18f4455 or I would give that a try.
Cheers
Errol

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by Errol »

Hi Martin
Did you mean osccon=0x60;
Can you tell me how the following were set under chip==>configure
USB CLOCK=
CPU SYS CLK =
OSC SELECT =
OSCILLATOR =
I have now tried my first program with a 18F2550 with no luck and tried it with osccon=0x60;.
I do have a work around that works. It is a Flowcode that I found on the forum
that I have reworked. It works with a 4Mhz crystal.
Errol
Attachments
rs232StringMacro.fcf
(7.5 KiB) Downloaded 320 times

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: Pic18F4550 RS232 sending a string

Post by medelec35 »

Errol wrote: Did you mean osccon=0x60;
Yes I did :)
Here is a screen shot of configuration:
18F4455 Config.png
(247.9 KiB) Downloaded 6146 times
Hope it helps

Martin
Martin

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550& 18F2550 RS232 sending a string

Post by Errol »

I've been away for a while. Been working on a couple of solar projects.
Decided to buy the upgrade to V5 and am back to the same old problem The SendRS232String just does not work....
I have attached a PIC18F2550 flowcode v5.5x.
I use a VT100 escape code macro to clear the screen and am using 9600 baud 8bit no parity one stop.
Configuration looks like this:
config.JPG
config.JPG (100.92 KiB) Viewed 9410 times
I can not believe that this is not happening to others.
If any one has any ideas? or is this a problem that has carried over from 4.5?
Attachments
2. Simple Echo 18F2550.fcf
(15 KiB) Downloaded 329 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by dazz »

HI Errol
Try setting your config as attached image and see if it helps, i suspect its a config issue as you say it works with another chip, also your using a 28pin chip yes , if so rx tx is on pins 17 and 18 ,pins 25/26 are rx tx on the 40pin chips

Regards

Dazz
Untitled.jpg
(246.25 KiB) Downloaded 2531 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Errol
Posts: 39
Joined: Wed May 18, 2011 11:15 pm
Has thanked: 9 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by Errol »

Hi Dazz
You must walk on water, the changes you suggested did the trick :D
I thought that I had tried every combination but did not even considered your changes....
I'm not sure how to send you a thanks so you will have to settle for a :D Thank You
Errol

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: Pic18F4550 RS232 sending a string

Post by dazz »

Hi Errol
Power Up Timer justs adds a delay so the oscillator can stabilize
Port BA/D Enable switches port b to either digital or analogue (seems to play havoc with lcd's)
Low Voltage Program does weird things to the chip if programing at higher voltages
Extended Cpu Enable Adds an extra set of assembler instructions to the pic, and if not used (ie by flowcode) can have strange affects on the program

to thank if you look at a post between the options box and the username theres a thumbs up icon click on it and it gives thanks

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply