• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need to send data on RS232

Yossarian451

Senior member
I am trying to debug a PIC that I am programing and we need to send out data in a formatted way on RS232 to emulate that of a certain PLC for a project. We are making a simple data logger and I seem to remember in the past that there is a program that will easily do this.

We cannot use hyperterminal to send the data properly, though we use it to debug the data coming back. Right now we are using matlab to send the serial data but that is not working very well and we seem to have corrupted data that way. I am not sure if it is matlabs fault or if it is the hardware, we actually have an 18f2480 hooked up to max233 chip, and it sends fine to hyperterminal. Hopefully you guys know what I can use, I remember seeing people having simple programs for this purpose but google has given me nothing useful. Thanks
 
RS-232 is spec'd for +10/-10 volt or so centered at 0 volts. The MAX232 generates supply voltages for the rs-232 output swing. So, you're OK there. But, I don't think the 18f2480 PIC outputs anything but TTL levels. ( after perusing the 300 page "data sheet")

I re-read your post and I take it you are using a MAX232 as an RS-232 driver for it. Be aware, though, some other equipment is only "pseudo RS232". The sig has more like a TTL swing. Scoping it out will show any of these level shift probs.

On the software end, if this board is talking to a PC, I think you could just run a VT100 emulator to the serial port. Or, a program on the PC can easily send/receive characters directly to the serial port with a tiny bit of coding.
Edit: www.freedownloadmanager.org/downloads/terminal_emulator_software/
 
Sun has their Java Communications API which will does serial port communications. It's very easy to modify the sample code they give you to make a simple telnet program. I would try highwire's suggestion first but the Java will allow you to have greater control over what you are specifically sending. I have used it previously to write programs to automatically set and receive data from power supplies and DMMs.
 
Thanks, yeah I have the hardware part down, just having a problem with the software to send. I will try those suggested once I have time to get back to the lab Monday.
 
Hardware OK, check.
Here is another term prog. That link in my prev post turns out to be demoware. This one is techier and free. no install needed. It Launched right out of its zip file.

http://www.sofotex.com/Hercules-SETUP-download_L36425.html
I think this Hercules prog may be quite good for lab work such as yours. It is a more basic com connection than hyperterm.

I don't know what your garbling of data looks like. But, just a reminder. Terminal emulator programs usually default to other than raw data stream handling. They will then intercept some characters ( escape v, s, etc ) and inject extraneous control characters and other stuff. Make sure the term prog is not using X-on, X-off software flow control, just raw through-put if the other end doesn't use any of these controls.

Also, there is an updated Hyperterminal beyond the one supplied with Windows. The blurb alludes to issues with previous versions. (maybe when used with W2000 or XP) :
http://www.hilgraeve.com/htpe/index.html

Something to do while you eat your morning donut monday.

 
I don't recall the specifics, but if you're polling for serial data on the PIC, you need to make sure you're polling at ~10X the data rate; the PIC has a very small Rx buffer.

You could probably check to see if that is the problem by slowing down the baud and see if you're still getting currupt data.

Thre were also some wrinkles if you are using interrupt routines ... but I don't remember them off the top of my head, it's been a while.

Good Luck

Scott

 
Back
Top