Page 1 of 1

Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 3:01 am
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??

Re: Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 7:22 am
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

Re: Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 6:48 pm
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

Re: Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 9:29 pm
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 402 times

Re: Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 10:31 pm
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

Re: Pic18F4550 RS232 sending a string

Posted: Thu Jun 07, 2012 11:05 pm
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

Re: Pic18F4550 RS232 sending a string

Posted: Fri Jun 08, 2012 1:17 am
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

Re: Pic18F4550 RS232 sending a string

Posted: Wed Jun 13, 2012 2:14 am
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

Re: Pic18F4550 RS232 sending a string

Posted: Wed Jun 13, 2012 7:55 am
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

Re: Pic18F4550& 18F2550 RS232 sending a string

Posted: Thu Apr 11, 2013 2:21 am
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 10027 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?

Re: Pic18F4550 RS232 sending a string

Posted: Thu Apr 11, 2013 11:04 am
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

Re: Pic18F4550 RS232 sending a string

Posted: Thu Apr 11, 2013 4:28 pm
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

Re: Pic18F4550 RS232 sending a string

Posted: Thu Apr 11, 2013 4:40 pm
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