PDA

View Full Version : RS485/422 to UART , TTL



amgen
- 21st September 2011, 18:49
Has anyone here tried hooking up an RS485 or 422 type device directly to UART pins on a PIC without a converter. I know there is A,B and GND signals with differing polarity related to ground ?

Don
amgen

Charles Linquis
- 21st September 2011, 22:49
I have done it many times. MAX13080E. Why would you need a converter? The MAX parts have logic levels on one side and RS-485 signals (both full and half duplex options) on the other.

amgen
- 22nd September 2011, 00:52
I am looking at WizNet810 485 to ethernet module, about $20, and I always try to reduce/eliminate glue-logic. I have been using the wiz710 serial to e-net but the uart output of TX & RX has to be inverted. Thats why I was wondering about hooking directly to the module in-out with no other items on the 485 bus. I think the module has half and full duplex, selectable.

Don

dhouston
- 22nd September 2011, 01:52
If you mean Wiz107 & Wiz108, the 108 requires a differential input which you cannot do directly - that's why they make transceiver chips. Why not just use Debug/DebugIn and invert the logic with your Wiz107 serial adapter?

amgen
- 22nd September 2011, 03:21
Yes, meant Wiz108 and 107, I don't have a 485 device for testing. But just thinking, differential input only means A>B by 2volts and B>A equals the 1's and 0's, so may be able to use voltage divider resisters on A or B and TX then on other pin for transmit to 485, and to recieve from 485 is just one of the differential outputs and gnd.
I am now using hardware TX and RX from USART and interrupt for both in my program to send and recieve data. Since Debug isn't for interrupts, that would change the whole setup.
The 107 generally works OK but it would hap-hazardly(?) erase its flash IP settings making it inoperable until reprogramming the flash, but it seems better since loading newer version of operating program from WIZ.
I also saw the $30 802.11 WIZ module a few days ago and would like to try that too.

Don

dhouston
- 22nd September 2011, 11:21
What PIC? On some (e.g. 16F88), you can access inputs/outputs of both comparators and use them as inverters.

However, I haven't used the Wiz107SR module you are using, but most serial-to-ethernet modules intended for interfacing with a µC use positive logic. And, the datasheet for the Wiz107SR indicates you should make direct connections with no need to invert. Connect module TXD to PIC RX and module RXD to PIC TX. You may need to jumper RTS & CTS if you are not using flow control (seldom needed for this) but this may be handled in the configuration of the Wiz107SR

amgen
- 22nd September 2011, 13:37
Thanks Dave,
I have been using the 107 for a while and once familiar, its straight forward. Have you used the WIZ programming tools yet ?
There is config prog for serial hookup and one for network access.
The 107 has a RS232 converter, so when I first started using it I had to use inverted mode serout to hook-up direct to send and recieve, then going to hardware TX & RX on an 18F2525, that polarity is oposite RS232 so I added transisters to invert both signals. Now, I havn't tried the TX,RX polarity setting in BAUDCON reg. I have the TX also hooked to a FTDI usb serial module so I can read the data on Hyperterm while turning on and off the network connection.
5995
Saw your other post about shield (why is it called shield ?). I will look more at that, can you add hookup for the new WIFI module along with the 107 and 108. I am interested in those circuits and assemblies.

Don
amgen

dhouston
- 22nd September 2011, 15:09
"shield" is Arduino's terminology for the stackable add-on boards. See...


http://davehouston.org/Arduino.htm

Thanks for the picture - that clears things up. WizNET's documentation is sometimes lacking. I'll need to make sure they're not doing something equally idiotic on the WizFi810. I have the Wiz110SR so assumed the Wiz107SR would not be a duplicate but w/o a DB9.

It makes no sense to do shields for the Wiz107 & Wiz108 as the shields interface with a µC that expects/uses positive logic. I need to keep the designs as universal as possible. If they have a similar module w/o the transceiver, I'll consider designing the shield to accept one or the other.

And, I do not know when I'll get them built. I have age/health issues (plus hospital/doctor bills) that will delay things. On top of that, nurses from the VA visit almost daily so it's tough to get any continuity going on my projects.

I've not tried the 18F2550 so don't know whether you can invert both TX & RX. Nor do I know whether you can get at the comparators to use them as inverters. Maybe others who use it can comment.

dhouston
- 22nd September 2011, 15:20
I meant WizFi210.

I will look at incorporating support for their WIZ812MJ on the same shield as the WizFi210. It will be either/or as the WizFi210 is SMD and once installed you cannot "unplug" it and plug-in the WIZ812MJ.

dhouston
- 22nd September 2011, 20:34
I misread the Wiz812MJ datasheet - it's SPI or parallel - not serial. Their only ethernet-to-serial TTL seems to be the Wiz105SR and it may not be possible to mount to a shield designed for the WizFi210.

dhouston
- 23rd September 2011, 22:20
OK, the Wiz105SR just barely fits on a shield PCB with enough room left over to squeeze in a 2x6 header that can connect to the module via a ribbon cable. So, while I'm still waiting on answers to a couple of questions, I'm fairly sure I'll design a shield for the Wiz105SR and the WizFi210. Both are among the least expensive modules of these types.

amgen
- 23rd September 2011, 22:54
Dave,
the WIFI210 data sheet says UART input, Shoud it be soldered to some kind of connector pins so it can be removed or replaced ? Mabye the different modules could fit the same connectors so a choice of boards could be used, like wifi, ethernet, bluetooth etc.

6000
6001Don

dhouston
- 24th September 2011, 00:25
PICs and other µCs have UARTs - that's not the same as line drivers or transceivers. Fig. 9 in the WizFi210 manual makes it clear that it has 0-3V levels. The US dealer for WizNet checked the output of the Wiz105SR - it's 0-3V so it will need level conversion which can be as simple as a Schottky diode and pullup resistor (which will also work with a 3.3V supply). See this drawing which shows another (part of a) shield I'm working on that has six such level converters ... 6003