Using RTS and DTR in XOJO

Hello,
I have a basic serial port going, but I need to use the DTR and RTS lines for some triggering. I am looking at the documentation and it says that whenever I want to make a change to the line state, I need to

Changing property values does not automatically change the state of the hardware, you must call Reset or re-Open the connection in order for the change to take effect.

I am having a tough time figuring out how to set up the controls for these two lines, but am I supposed to shut the connection down then re-open it? If I do I m going to miss data packets.

Litte confused on this. THere was a thread on how to use these lines, but it is no longer available according to the site.

A little help would be appreciated

JIm

Just call the .Reset method or .Open (again). Closing the port/class makes it invalid for use again (youll need a new instance then, you don’t want that!).

In order:
set the .DTR = True/False or .RTS = True/False then call .Reset

Ok, thank you for the fast response!

Let me ask this. How would I set the action event to set the RTS line TRUE when I click the button, then False when I release the button?

For that you do inside the MyButton.MouseDown event:

MySerial.RTS = True
MySerial.Reset
Return True

In the MyButton.MouseUp event:

MySerial.RTS = False
MySerial.Reset

Don’t use the MyButton.Action event as it’s non usable for this purpose.

Ahhh! Thats slick! Thank You!

Jim

1 Like