Internet PLC Forum

General => Technical support => Topic started by: sntang on July 23, 2003, 06:01:28 PM

Title: Host-Link Command - Write Inputs
Post by: sntang 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!    
Title: Re: Host-Link Command - Write Inputs
Post by: support 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.