Recently I'm building a project that requires 2 serial ports. I'm using arduino mini pro for this project.
One port only receives data, and another one transmit and receive data and put the data inside a SD card. Data is not simultaneously transmit nor receive, so we can forget about the sequence which will clash on with the timing.
To meet all these requirement, i used SoftwareSerial for the extra serial port.
Eventually, I built a single MAX232 circuit to run these 2 serial ports but end up only one port is working. The other one is totally not function at all.
Hence, my question is, does MAX232 only can support one serial port? I checked the datasheet and found that it can support 2 ports. Or should i have to build with two MAX232 chips circuit for each serial port?
The datasheet for the MAX232 and all the other related chips is consistent in its own way. All the inputs and outputs are described from the point of view of the MAX chip. R1OUT is the output of the first receiver circuit. This is actually an input to your Arduino - the RX pin.
An Arduino Micro has only a few pins that can be used for SoftwareSerial RX. The Pro Mini does not have this limitation, so that's not your problem.
DTE and DCE are just conventions for wiring the plugs and sockets. If you plug a male into a female, the transmit on the male should go to the receive on the female. That's why you can never say if pin 2 is transmit or it is receive. It depends if it is a plug or a socket you are looking at.
Hello all! After several attempts, undergo numerous emotional swings, I had finally decoded this problem!
I attached the schematics to whoever in the future that encountered the same issue as i am.
I discovered that, some references found on the internet provide false/buggy information.
In SoftwareSerial, please do remember:
#include <SoftwareSerial.h>
const byte rxPin = 2;
const byte txPin = 3;
// set up a new serial object
SoftwareSerial mySerial (rxPin, txPin); //SoftwareSerial(rxPin, txPin, inverse_logic)
DTE and DCE are just conventions for wiring the plugs and sockets. If you plug a male into a female, the transmit on the male should go to the receive on the female. That's why you can never say if pin 2 is transmit or it is receive. It depends if it is a plug or a socket you are looking at.
I wish I had a dollar for everyone who didn't know that....
I would expert almost everyone to know that DTE represents a computer (or terminal) and DCE represents a modem. I would think that would be obvious, but plug/socket thing is something else.
Everyone knows that older computers with DB9 com ports had male connectors and those are DTE.
By the same token , anyone who ever bought a modem back in the day (before the internet when all they had was BBSs) knows they came with female connectors. Fewer people know that a null modem cable doesn't have the Tx & Rx crossed. But this part:
If you plug a male into a female, the transmit on the male should go to the receive on the female. That's why you can never say if pin 2 is transmit or it is receive. It depends if it is a plug or a socket you are looking at.
is less known I think, though it would seem obvious in view of the DTE/DCE thing.
It was nice back in the day. I have an RS232-HPIL convertor and HP thoughtfully explained everything about RS232. Sigh. I miss HP manuals. Back before the internet they were great references. Though, as pointed out above, you could trust HP! 8^)
(Though I am not sure why almost every manual had an ASCII table!)