News:

  • May 14, 2026, 03:59:26 PM

Login with username, password and session length

Author Topic: Setting up serial port from ladder  (Read 8506 times)

MarkTTU

  • Hero Member
  • *****
  • Posts: 293
    • SamJackson.com
Setting up serial port from ladder
« on: January 12, 2026, 03:04:50 PM »
I know there's a SETUPSER instruction and it works great, but I'm trying to provide a way for customers to select their comms parameters from the touch screen (c-more) and then implement that in ladder. I know there's not that many combinations (8 baud rates, 2 options each for data bits, stop bits, and parity), but I'm wondering if there's a way to programmatically tell the SETUPSER instruction to use 9600/8/N/1 or 2400/7/E/2 without having to just have 64 separate rungs controlled by a host of input logic.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6156
  • Yes Pinky, Do-more will control the world!
Re: Setting up serial port from ladder
« Reply #1 on: January 12, 2026, 05:32:10 PM »
I know there's a SETUPSER instruction and it works great, but I'm trying to provide a way for customers to select their comms parameters from the touch screen (c-more) and then implement that in ladder. I know there's not that many combinations (8 baud rates, 2 options each for data bits, stop bits, and parity), but I'm wondering if there's a way to programmatically tell the SETUPSER instruction to use 9600/8/N/1 or 2400/7/E/2 without having to just have 64 separate rungs controlled by a host of input logic.

There isn't, sorry.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: Setting up serial port from ladder
« Reply #2 on: January 14, 2026, 09:29:28 AM »
DEVWRITE Can write the various settings and you can change each parameter using valid values. See help on the instruction.

I've used it to auto detect the settings for a device I knew what a valid response looked like. Then I used stages to step through various combos that would be valid for the device I was using.

It would be simpler to just put in what a user wanted using six DEVWRITE instructions.

MarkTTU

  • Hero Member
  • *****
  • Posts: 293
    • SamJackson.com
Re: Setting up serial port from ladder
« Reply #3 on: January 14, 2026, 12:03:38 PM »
Thanks Mike! DEVWRITE looks like it should do the trick. Just have to make sure it re-runs at every power up, but that's not an issue.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6156
  • Yes Pinky, Do-more will control the world!
Re: Setting up serial port from ladder
« Reply #4 on: January 14, 2026, 12:13:03 PM »
I had honestly forgotten that we added DEVWRITE access to the port settings. I would have guessed it was DEVREAD only.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO