Hi to everyone,
I'm trying to connect an instrument to my Arduino Mega but I can't. I did all the trials of this world, but no way!
This is the instrument I need to connect:
http://www.hannainst.com/manuals/manHI_93530_531_532.pdf
As you can see at page 17 you can connect it with his cable (5 pin to female DB) and this is the protocol:
The communication is unidirectional (meter to receiving unit only) and
the transmissions consist in a 32-character ASCII string, compatible
with our optional HI 92000 software.
The 32-character data string is structured as follows:
Main portion of the LCD
• byte 0 probe type: K-thermocouple (k)
• bytes 1, 2 measurement channel: T1, T2, T1-T2 (Td)
• byte 3 measurement mode: Normal (blank), Relative (R),
Average (A), Average done (a)
• byte 4 operating mode: Hold (H), Memory recall (M)
• byte 5 blank character
• bytes 6-10 measurement: reading (XXX.X or blank XXXX),
over-range (OVRG blank), no data (blank ----)
• byte 11 temperature unit: C, F
• byte 12 blank character
S e c o n d a r y L C D , l e f t p o r t i o n
• bytes 13, 14 info description: low temperature (Lo), T1 (T1)
• byte 15 blank character
• bytes 16-20 measurement: reading (XXX.X or blank XXXX),
over-range (5 blanks), no data (blank ----)
• byte 21 blank character
S e c o n d a r y L C D , r i g h t p o r t i o n
• bytes 22, 23 info description: high temperature (Hi), T2 (T2)
• byte 24 blank character
• bytes 25-29 measurement: reading (XXX.X or blank XXXX),
over-range (5 blanks), no data (blank ----)
• byte 30
• byte 31 line feed
I used the below schematic to connect intrument -> max232 ->arduino mega
and this sketch to read the input on Arduino 1.0 IDE:
void setup() {
// initialize both serial ports:
Serial.begin(1200);
Serial1.begin(1200); //the instrument's baud rate is 1200
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);
}
}
These are the connections of the 5 pin RS232:
1 - CTS
2 - DTR
3 - GND
4 - Rx
5 - Tx
And these are the connections on the female DB9 connector:
1 - NC
2 - Rx grey
3 - Tx yellow
4 - (Data termina ready) brown connetced with pin 6
5 - white GND
6 - (Data set ready) see pin 4
7 - Request to Send connected with pin 8
8 - Clear to send green
9 - NC
Connecting the instrumets with the pc by hyperterminal it works properly, every seconds it gives me a 32-character ASCII string but if I connect with Arduino nothing happens!
Can anyone help me and teach me what I'm wrong?
Thanks to those who want help me,
Alberto