I would like to use a device with MRL that is serial and I cannot figure out how to set DTR and RTS. The device is optically isolated and steals power from the PC. It needs DTR (pin 4)to be high and RTS to be low (pin 7 on a 9 pin serial connector). The signals don’t need to cycle. Using a USB to serial cable and a terminal program (Mitty.exe) I can communicate with the device at 19200 baud. But in MRL, the rtscts and DTR lines below gives errors.

port = "COM6"

serial = Runtime.createAndStart("serial","Serial")

serial.connect("COM6",19200, 8, 1, 0)

serial.rtscts=0

serial.DTR=1

 

Is there a way to set these pins in MRL?

 

 

kwatters

6 years 4 months ago

Ahoy harland!

Just to understand, you have a device that you want to communicate with with a N81 @ 19200 Baud. 

So, under the covers we use a library called JSSC  and most of that functionality is exposed on the "port" of the serial service.

so in theory something like the following should work:

serial.port.setDTR(True)

and 

serial.port.setRTS(True)

Here's a code pointer:
https://github.com/MyRobotLab/myrobotlab/blob/master/src/org/myrobotlab…

good luck!  

 

 

that works setting DTR ture moves pin 4 to 9v and setting RTS false moves pin 7 to -9v.

It then powers the serial port in the Mate. I have been using a 9 volt battery to power the pins.

Really appreciate the help!