Citect,bit value for variable tag

bshinde

Member
Join Date
Nov 2005
Location
pune
Posts
15
Hello all,

can one tell me how ,one can get a bit or byte level information (displaying it)from a variable tag decleared as "LongINT".

can ine write or read the same,in citect.Also how one can declared a variable tag as BCD.(There is no detailed help for the above topics in citect)


Thanks
 
This works for INTs, Have not tried on LongINT.


If (MyInt BITAND 1) = 1 Then
//Do something as Bit 0 is true
END
If (MyInt BITAND 2) = 2 Then
//Do something as Bit 1 is true
END
If (MyInt BITAND 4) = 4 Then
//Do something as Bit 2 is true
END
If (MyInt BITAND 8) = 8 Then
//Do something as Bit 3 is true
END

Greg
 
hey

Greg is correct about using bitand and it works for longs aswel.

For your BCD problem, in the variable tag definition you can select BCD or LONGBCD instead of INT OR LONG

Greetz,

Marsupilami
 
hi,

i aggre with you ,but i need to know what should i prefix For BCD
i.e For INT we declare the address for memory location as "I1" ,for say LONG we have it as "L1" ,what for BCD ?
 
Thanks for that, it works ! i will come back to u when i have finally tested it .Also can we use TagRead ,TagWrite function in this case,if yes how can we,can you give me a example.


thanks for that
 
Hey,

So for a long BCD the address would stay L1 and for an INT BCD it would stay I1. further the addresssing depends on the type of PLC you use.

For using tagread and write just use them as you normally would, citect will do the conversion for you. (i have not tested this, this is how i think it would work). Just be careful when using tagreads and writes it gives a heavy load on you system and bloks your code.

Greetz,

Marsu
 
well can one tell me ,

1)i need to generate a report in VB .i have allready made a exe for that.
2)now by using check uncheck sign i need to generate the report,i have also made the same
3)but i have a problem i need to fire a event(digital) to generate
a respectine tag to be logged ,in the report file.

know the problem is i have make around 70 to 80 memory tag for the same.but if want to do it using LONG or say int how can i do it but the output should be value based.

can one help me on this.
 
Extracting Bit Information

There must surely be an easier way of extracting bit information?

If there isn't what would the most significant bit be? Would it be

'MyTag bitand 32768'
 
it is not that hard to write a function to test a certain bit number.

int function BitTest(int value, int bitnumber)

int p = 2 pow bitnumber

return value bitand p

end


or something like that, havent tested the code.
 
Thanks

I know this is not my thread but I am thankful to everyone that has posted. I've just used 'bitand' in some Citect Code to convert bit information from a double word.

Thanks all.
 

Similar Topics

Hi, I have a simple modbus addressing question. i can read a register word at 40015 but how do i address bits 0 -15 at bit level, what is the...
Replies
2
Views
3,170
I have a problem writing to the remote control zone to trip the Sepam 80 module via Citect. I am able to connect to the Sepam 80 and read other...
Replies
1
Views
3,263
Hi I had a problem yesterday addressing a Data Word with Citect. The format need was Dxxx:zzz.bit Where the xxx was the data block ie 010 (DB10)...
Replies
6
Views
4,777
Hello, the system we use is Scada 7.5 series. We have usb key activ now we need additional key to make the system work, how do we solve this...
Replies
0
Views
50
So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
71
Back
Top Bottom