Internet PLC Forum

General => Technical support => Topic started by: Machinery Automation Ltd on July 25, 2002, 11:50:59 AM

Title: Understanding Bits
Post by: Machinery Automation Ltd on July 25, 2002, 11:50:59 AM
Hi all

I am trying to further understand how the T100MD+ assigns bits.....

i have assigned DM[1] to be the control register for a HMI unit (Taian OP26L)

if i wanted to switch bit 12 on, am i right in believing i use the statement

DM[1]=1024

assuming that
bit 0=0,
bit 1=1,
bit 2=2,
bit 3=4,
bit 4=8,
bit 5=16...
..etc..etc...
bit 12=1024

or have i completely missunderstood how this works?

any comments greatly appreciated..

thanks

Russ
Title: Re: Understanding Bits
Post by: support on July 25, 2002, 05:26:42 PM
You can use the statement:

  SETBIT DM[1], 12

to turn on Bit #12.

If you need to do bit manipulation, you will do well if you assign an internal relay channel to be used as the control register for the HMI. E.g. RELAY[16] occupies relay #241 to #256. You can then define label name for each of these relays and they can be set using the ladder diagram or in custom function using SETIO and CLRIO commands.