Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RS-485 testing problems

Status
Not open for further replies.

Sodrohu

New Member
Hello again! Fresh from another proejct, I am tasked with a new one...this time involving the venerable RS-485! Now, the network requires a bunch of devices, about 10 let's say, connected to a PC. THe devices will periodically send data to the PC. The PC, for the most part, only receives data, but can send commands as well to any devices. Looks like I have a transceiver-transceiver network here....

This is the first time I've tried my hands on this RS-485 thing, so I'll get the PIC-PC data sending correct first before trying to make everything tranceiving stuff. I'm using PIC18f4580 with SN75176 using modified codes from Jan Axelson's website.

I got one big problem so far. I've tested a working prototype board on Proteus, built one in real-life and tested the circuit. However, I'm using Hyperterminal on XP with no handshaking and the RTS pin from the serial port didn't go low after transmitting data. As such, it cannot receive any data from the PIC. I know the PIC did receive data and send back responses owing to the output LEDs but data isn't being received on the PC side(again, based on output LEDs and Hyperterm's own output).

I later made mods to the circuit, so that, on the PIC side, the pin that drives the SN75176's RE and DE high when transmitting data will also drive the SN75176's RE and DE on the PC side low to enable receiving. This in effect turns the line from two to three. It's wrong, but I'm just doing it to see how it'll really work if the RTS pin is working properly.

So how do I go on making the RTS pin working correctly? I know I can just create an app using Visual Studio to connect to the line and have RTS toggled manually, but doing so is too troublesome and I'd rather have a hardware solution if possible. Here I attached my circuit for better understanding.
 

Attachments

  • PIC Storage Hub.jpg
    PIC Storage Hub.jpg
    97.9 KB · Views: 211
Well, this is a bummer.

I've looked around the net and AFAIK there's no RS-485 solution that handles the RTS automatically using hardware...although I've found one circuit that seems to use an uc to control the RTS line (see attachment). Now I have two alternatives I can think of, none of which I like:

1. Forgo the hardware approach and use software...which would've solved my problem had it been actually working. I'm using VB2010 and my custom software, so far, can't communicate correctly with the circuit (Hyperterm can). Besides, although VB's serialport class had the option to turn off/on the RTS during data send/receive, it's useless if you can't connect to the device first...

2. Turn the rs-232/rs-485 converter into a USB-to-RS-485 converter. This approach appeals to me, since other commercial circuits I've found uses this method too, and it seems that you can control the RTS line thru USB too. Now I'll just need to order some 18f4550 since all I've got are 4580s..

3. The 18F4580 has ECAN! Maybe I can use it, since Microchip already has a CANopen Stack for PIC18 ECAN Microcontrollers..and the hardware specs of CAN bus is similar enough to RS-485(maybe, needs more reading on that one....)
 

Attachments

  • 232to485cctsm.png
    232to485cctsm.png
    33 KB · Views: 202
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top