Page 1 of 1

rs 232 error

Posted: Thu Sep 15, 2011 8:40 am
by nuwan5213
hi.
im going to get keypad number and unit id to pc via rs 232 com port
i use 9600 and 19200 also but i can recive [~~~~~~~ü€ø þ þ€àüàþà€ þü þàþð€ þ À ü þþ €ü]
like that.
im sending strings
simiulation mod is ok and it displays what i typed with key pad.

whats the problem with it?
im using 16mhz xtal and is it ok? propertis window of that will attached.
computer setting are ok ,com 1 properties changed to 19200.
please help.
should i have to change the xtal?

Re: rs 232 error

Posted: Thu Sep 15, 2011 8:53 am
by medelec35
Personally I have found that if using software rather that hardware (using built in TX pin in case of 16F877 is pin 25 = RC6), you are much more limited to the maximum speed.
What about reducing baud to 4800? Then if works, increase to 9600 etc.
Also the length of RS232 lead can have an effect if too long. Personally with good quality cable , I would not go more than 2 metres in length, and I think that would be pushing it.

Other people may have different opinions of course.


Martin

Re: rs 232 error

Posted: Thu Sep 15, 2011 9:03 am
by Mikat
Hi.

What comes to the cable,at my boat I use over 5m total lenght cable to data link for self made Eberspäher ecu and the heater fan controller, and it has at least 3 connections on the way, cable is normal Samtec multi wire and baudrate is 9600, no problems..
But the data is just about 15 bytes at once a second and the uart is run by hardware...


Mika

Re: rs 232 error

Posted: Thu Sep 15, 2011 9:42 am
by medelec35
Found this on:

http://www.lammertbies.nl/comm/info/RS-232_specs.html

Code: Select all

Baud rate		Maximum cable length (ft)

 19200                    50

 9600				        500

 4800				        1000

 2400				        3000
So I have probably misread the length somewhere.

Martin.

Re: rs 232 error

Posted: Thu Sep 15, 2011 9:45 am
by nuwan5213
No change redusing to bud4800.
is it softwear bug.
please help.
regards
nuwanNo change redusing to bud4800.
is it softwear bug.
please help.
regards
nuwan

Re: rs 232 error

Posted: Thu Sep 15, 2011 9:47 am
by Benj
Hello Nuwan,

Have you tried using the Hardware UART in Flowcode rather then the software UART. The software UART is nowhere near as reliable as the hardware UART so this is a good starting point. Have you performed a 1 second flasher test to ensure your clock speed and configuration settings correctly match your hardware?

Re: rs 232 error

Posted: Thu Sep 15, 2011 9:56 am
by nuwan5213
Ididnt get you ben?

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:12 am
by nuwan5213
Can you please check my flow chart?
regards,
nuwan.

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:15 am
by Benj
Hello,

Create a while 1 loop which switched on a output pin, delays for a second, switches off the output pin and finally delay for a second.

Send this program to the hardware and connect a LED to your output pin.

If the LED flashes at the right rate eg 0.5Hz then you know you have your clock speed and configuration settings correct for your hardware.

This also means things like the RS232 baud rate is being calculated correctly for your hardware.

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:18 am
by Benj
Your program looks ok to me as you have configuration settings and a non standard clock speed.

Have you tried using the UART in hardware mode rather then software mode. Right click the RS232 component, select ext properties and then set the TX/RX to UART1.

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:33 am
by nuwan5213
Hi ben,
1herts flasher is runing perfectly.
regards,
nuwanHi ben,
1herts flasher is runing perfectly.
regards,
nuwan

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:41 am
by nuwan5213
Yes.i tryed uart1 also.
but no results.
regards,
nuwan.Yes.i tryed uart1 also.
but no results.
regards,
nuwan.

Re: rs 232 error

Posted: Thu Sep 15, 2011 10:44 am
by Benj
Hello Nuwan,

OK what do you have connected to your PortC. Are you using a RS232 E-block or are you using your own hardware.

If your using the E-block then are the jumper settings correct, option C should work for the 16F877.

Do you have a scope or anything similar you can use to check if the UART pins are waggling correctly.

Re: rs 232 error

Posted: Thu Sep 15, 2011 11:14 am
by nuwan5213
Not eblock.
my own hw.
i have fluke 187multimeter.
regards ,
nuwan.

Re: rs 232 error

Posted: Thu Sep 15, 2011 11:47 am
by Benj
Hello,

Do you have a schematic for the hardware so we can have a look and make sure this is all ok.

Have you used your multimeter to confirm that everything is connected up correctly. You may even be able to use the PWM mark space monitoring on your meter to see if the TX pin is toggling correctly.

Re: rs 232 error

Posted: Thu Sep 15, 2011 12:06 pm
by nuwan5213
hi ben.
please check my cct.

Re: rs 232 error

Posted: Fri Sep 16, 2011 2:03 am
by nuwan5213
Hi again,
benj,medelec,
problem solved.i just changed max232 ic.it works nicely.
thank you for your quick responses.
regards,
nuwan.Hi again,
benj,medelec,
problem solved.i just changed max232 ic.it works nicely.
thank you for your quick responses.
regards,
nuwan. :idea: