Author Topic: Host-Link Command - Write Inputs  (Read 6771 times)

sntang

  • Newbie
  • Posts: 3
  • I love YaBB 1G - SP1!
    • View Profile
Host-Link Command - Write Inputs
« on: July 23, 2003, 06:01:28 PM »
Hi,

I wrote a VB program talking to PLC using Host-Link Command. I wanted to control input#16 and input#17 from the VB GUI. The technical information from the user manual on how to send a Host-Link command to write a input is too brief. So my guessing:
a) Write a logic 1 to input#16:
     "WI0180*" + CR
b) Write a logic 1 to input#17:
     "WI0201*" +CR

But I suspect my guessing is wrong.

Please advice. Thanks!    
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3170
    • View Profile
    • Internet Programmable PLCs
Re: Host-Link Command - Write Inputs
« Reply #1 on: July 24, 2003, 07:15:11 AM »
Input #16 belongs to channel 00. So you should be writing to "WI0080*" to turn ON input 16.  However, note that doing so will also affect input #1 to 15 by turning them OFF momentarily. This may have effect on your ladder logic program.

The correct way of doing it is to first read from channel 00 usign RI00*. Then use the OR mask to set the bit of interest:

      INVAR = INVAR | &H80   ' force bit 15 to ON

Then write it back to the PLC using the

"WI00"+ INVAR (converted to two digit hex)+"*"+CR.



« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS