profor
Active member
Hello,
i am working on a project, where i will be able (using teensy) to "talk" to HART enabled transmitters on 4-20mA loop.
HART protocol is known to me, so there is no problem understanding the messages.
I am using old HART modem Endress+Hauser Commubox FXA191 where i put USB to UART converter using CP2102 chip.
The HART modem is set to 1200 / Odd parity / 1 stop bit. The modem requires the RTS to start modulating the HART message to the loop.
The RTS is active LOW.
Now i put Teensy between the CP2102 USB converter and the Commubox.
CP2102 is connected to Serial3
HART modem is connected to Serial2
I would like to use Serial2.transmitterEnable(pin) to "simulate" RTS for the HART modem, but the pin goes HIGH during transmission. My HART modem requires the RTS to be LOW during transmission.
Is it possible to change the "polarity" of the transmitterEnable(pin) somehow? Or should i use transistor to change the polarity (i would like not to)?
Please note, that the CP2102 RTS is on channel 4 of analyser.
Channel 5 is my transmitterEnable pin.
Thank You
Dusan
i am working on a project, where i will be able (using teensy) to "talk" to HART enabled transmitters on 4-20mA loop.
HART protocol is known to me, so there is no problem understanding the messages.
I am using old HART modem Endress+Hauser Commubox FXA191 where i put USB to UART converter using CP2102 chip.
The HART modem is set to 1200 / Odd parity / 1 stop bit. The modem requires the RTS to start modulating the HART message to the loop.
The RTS is active LOW.
Now i put Teensy between the CP2102 USB converter and the Commubox.
CP2102 is connected to Serial3
HART modem is connected to Serial2
I would like to use Serial2.transmitterEnable(pin) to "simulate" RTS for the HART modem, but the pin goes HIGH during transmission. My HART modem requires the RTS to be LOW during transmission.
Is it possible to change the "polarity" of the transmitterEnable(pin) somehow? Or should i use transistor to change the polarity (i would like not to)?
Please note, that the CP2102 RTS is on channel 4 of analyser.
Channel 5 is my transmitterEnable pin.
Thank You
Dusan
Code:
#define RTSout 2
#define USB Serial3
#define commubox Serial2
void setup() {
pinMode(heartbeat_led, OUTPUT);
pinMode(backlight, OUTPUT);
pinMode(psuMosfet, OUTPUT);
pinMode(relay, OUTPUT);
pinMode(buttons, INPUT);
pinMode(led1A, OUTPUT);
pinMode(led1K, OUTPUT);
pinMode(led2A, OUTPUT);
pinMode(led2K, OUTPUT);
pinMode(RTSin, INPUT_PULLUP);
// pinMode(RTSout, OUTPUT);
// digitalWrite(RTSout, LOW);
USB.begin(1200, SERIAL_8O1);
commubox.begin(1200, SERIAL_8O1);
commubox.transmitterEnable(RTSout);
// commubox.attachRts(RTSout);
lcd.init ();
lcd.clear ();
lcd.setContrast(15);
ltc.init(LTC4151::L, LTC4151::L);
delay(1000);
}
void loop() {
serialComm();
}
void serialComm() {
if (USB.available()) {
int inByte = USB.read();
commubox.write(inByte);
}
if (commubox.available()) {
int inByte = commubox.read();
USB.write(inByte);
}
}