max232 question

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

max232 question

Post by FFMan »

Is the max232 just a level converter. i.e. when troubleshooting my comms does the max232 care which pin is rx or tx on either side (ttl or rs232) or does it just dumbly convert the voltage levels?

i.e. If i suspect i have my tx and rx reversed, does it matter if i swap the input to the max232 or the output ?
dlh
Posts: 395
Joined: 15 December 2006, 12:12 PM
Location: ~Cincinnati

Post by dlh »

It both inverts and does level conversion. It does matter how it's connected. See the example interfaces Don has provided. For example see ZX-40 Series Suggested Circuits.
Last edited by dlh on 31 January 2011, 15:37 PM, edited 1 time in total.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: max232 question

Post by dkinzer »

FFMan wrote:does the max232 care which pin is rx or tx on either side (ttl or rs232)?
You must connect the pins correctly. It has two types of input pins ("TTL" and "RS232" levels) and two types of output pins ("TTL" and "RS232" levels). The "RS323" levels are logically inverted and swing from negative to positive voltage while the "TTL" levels are logically non-inverted and swing from 0 to +5 (or so). The datasheet for the device describes exactly what each pin does and may include example circuits.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

sorry i don't think i was clear. i understand that there is a pair of ttl side pins, and a pair of rs232 side pins, but i was asking if it matters which ttl pin is connected to say the tx pin on the zx or does it not matter so long as the rs232 side matches ?

its not always clear from diagrams which is rx and tx as what is rx to one device is tx to another.
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

i'll connect it as per the diagram, though i'm still 100% sure, when the labels say TX does this mean TX from the ZX or TX from the Max232 ?

I am assuming labels are device-centric so TX is TX from the Max232 and connects to the RX on ZX ? so in my case the com2 tx pin is pin 11 and this connects to pin 12 on the max232 ?

On the rs232 side, both lines are idling at about -9v when the modem is connected, which implies to me that I have the tx/rx pin situation right on that side.
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

Post by twesthoff »

It doesn't matter which Rx and Tx you use, they are all independent. You can use either one. The pins labeled TTL/CMOS are the ones that go to the microprocessor.

Think of the triangle shapes as arrows showing the direction of the data flow. On the MAX232, RS-232 data from the outside world going to the processor (received data) would go into pin 8 (or 13) and come out pin 9 (or 12) and go into the processor RX pin.

The processor TX pin sends data out as TTL/CMOS into pin 10 (or 11) which comes out of the MAX232 chip as RS-232 data on pin 7 (or 14).

Note that the appropriate pull-up/pull-down resistors are inside the MAX232 chip.

Hope this helps.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:when the labels say TX does this mean TX from the ZX or TX from the Max232 ?
Usually, the labels Rx and Tx are from the perspective of the device on which they appear. However, you should always check the datasheet. The diagram below is excerpted from the MAX232 datasheet. The symbols and labeling used make it pretty clear which pins are inputs, which are outputs and what the levels are.

The pins labeled "TTL/CMOS OUTPUTS" can be connected to any ZX input pin while those labeled "TTL/CMOS INPUTS" can be connected to any ZX output pin.

Note, too, that as Tom mentioned, this particular chip has pullup/pulldown resistors built in.
Attachments
max232.jpg
max232.jpg (39.22 KiB) Viewed 8001 times
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

thanks chaps - that is clearer now. I was working from a diagram from the zx Basic Language Reference PDF which shows the max232 but doesn't have as much detail.

I hadn't realised the max232 contained 2 pairs of drivers, or that it had pull-up resistors. the diagram provided by don above is much clearer thanks.

I guess i could use on of the other drivers to give me a ttl level DCD rather than using my voltage divider affair i have at present (though it does appear to work).

I'll troubleshoot it tonight and expect i'll get it working.
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

Post by twesthoff »

FFMan wrote: I guess i could use on of the other drivers to give me a ttl level DCD rather than using my voltage divider affair i have at present (though it does appear to work).
Yes, that is what the extra drivers are for..
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

FFMan wrote:I hadn't realised the max232 contained 2 pairs of drivers, or that it had pull-up resistors
That's why datasheets are so important. You should always read the datasheet for any device you use so that you fully understand its capabilities and limitations. They usually contain a wealth of useful information.

Although it is common for level converter chips to have pullup/pulldown resistors you must check the datasheet of the particular device you're using to ensure that they are present.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post by FFMan »

thanks for the help - got it working - helps when you don't miss off a charge-pump capacitor !
Post Reply