Author Topic: Relay Bit Manipulation  (Read 11212 times)

Stiefes

  • Newbie
  • Posts: 1
  • Innovative Controls
    • View Profile
Relay Bit Manipulation
« on: October 24, 2013, 01:08:18 PM »
Sorry if this is posted somewhere but I cant find it.

How do I manipulate bits in BASIC?

This is wrong but this is how I would invision it to be like.
If
  Relay[1:0]=1 & Relay[1:1]=1 Then
  Relay[1:2]=1
Endif

In ladder I would do it like this
    Relay#1      Realy#2                                           Relay#3
-----| |-----------| |-----------------------------------------( )---------

any way to do this in BASIC?

ScarBelly

  • Newbie
  • Posts: 6
  • I'm a llama!
    • View Profile
Re:Relay Bit Manipulation
« Reply #1 on: October 24, 2013, 01:34:19 PM »
Here is a little snippet of mine that should clear things up.

If TestBIT (Relay[1],0) Then
   CLRBIT Relay[1],0
Endif

'Use TestBIT here for your application
If TestBIT (Relay[1],0) AND TestBIT (Relay[1],1)Then   
  SetBIT Relay[1],2      
           
EndIf