
Darren360 (Customer) asked a question.
Access a bit in a click DS register?
The C-More micro 'PLC to Pane'l dialog references turning on bit 15 to enable touch screen beep functionality. Sounds easy enough...
I am using DS103 as my start word, so I expect DS104 would be where I need to turn on bit 15 to enable the touch screen beep.
So, how do I manipulate an individual bit (bit 15 in this example) in a DS word in the CLICK PLC?
Don't recall Click allowing partial variable access so just grab a contiguous section of bools (C100-C115 for ex) set the MSB of those 16 high and use a COPY to pack them into DS104.
Thanks for the reply. I will try that next. I have been working on this and did make a discovery - kind of...
When I enter the int value of '1' into DS104 I can turn the beep on and off.
The C-More dialog states that bit 0 is the Beep State (0=off, 1=on)
So that works and I can use the program in the CLICK to control the beep.
Now, to enable the touch screen beep on/off, if I need to change the value of bit 15 to a 1 or 0 so, one would assume that I can enter the 'int' value of 16,384 which would turn on bit 15 but it is not working as I expected.
BIN:0100 0000 0000 0000 = INT:16,384 = 15th bit on.
Ugg, I wish it could be addressed something like 'DS104.nn' to get to the individual bits in the word.
Cheers,
Darren
You're toggling the 14th bit, the 15th bit would be 1000 0000 0000 0000 or -32768 in decimal (for a DS register as it is signed).
SUCCESS and there is a potential bug in the documentation.
The documentation states that it is bit 15 that turns the touch screen beep on/off but I found it to be bit 16 - or MSB!
Bit 1 turns the beep on/off (LSB)
Bit 16 turns the touch screen beep on/off. (MSB)
Durallymax, I used your suggestion and that did the trick. So thank you for that!!!
I also went back to my original effort of changing the value of the 'INT' for DS104 and that worked too.
So, either way will work. Just watch out for the bit 15 catch. Unless they are counting from '0' then bit 15 would make sense. I was counting from 1 since Bit '1' is the bit that turns the beep on/off - making bit 1 the LSB and bit 16 the MSB.
Moving on!
Cheers,
Darren
No issue in the documentation, Bit 15 is the MSB of an Int16.