Author Topic: Read from rs232 port  (Read 10017 times)

charlie

  • Newbie
  • *
  • Posts: 1
  • I'm a llama!
    • View Profile
Read from rs232 port
« on: January 11, 2005, 04:26:41 PM »
Can someone help me with a program that  can read the RS232 port.  The ASCIIi number 100 followed by CR  turns on output one of the T100MD. If ASCII 100 CR is not present at the RS232 the output turns off. The PLC needs to countinually scan the RS 232 port.
Thanks
Charlie

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Read from rs232 port
« Reply #1 on: January 12, 2005, 10:28:40 PM »
Use a clock pulse to trigger a custom function periodically to check the serial buffer using the INPUT$(1) command.

  A$ = INPUT$(1)

A$ will contain the ASCII text string (single character in your case) whenever a CR is received. Otherwise, A$ returns an empty string. You can then check the first character in A$ using "ASC" function to determine if you wish to turn ON/OFF the output.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS