Forum Home › Forums › Uncategorized Issues › Reading bits
- This topic has 13 replies, 3 voices, and was last updated 4 years, 10 months ago by
baharsahin.
-
AuthorPosts
-
October 12, 2018 at 12:26 pm #4425
baharsahin
ParticipantHi,
I am trying to read my digital inputs. I have 16 different inputs in 16 different bits of one register (1001)
Then I created 16 different input channels with different channel numbers from 35 to 59. They all have the same signal number(354).
I selected the channel type as calculated discrete.
I am using GetBit formula like this;
GetBit(Cnl,0);
Formula used bar is checked.The problem is it just shows the value of the last channel (59) in the web.
The rest is 0 and this is wrong.I saw in the communicator that signal 354 is assigned to channel number 59 and the other channels from 35-58 were not in the list.
Could you please help me to solve this?
October 12, 2018 at 5:08 pm #4430Mikhail
ModeratorHi,
For input channels bound to the same device, signals have to be unique. Anyway, only one channel is bound.
To use value from a one Communicator tag in many channels use channels of calculated type for other channels except the 1st.October 15, 2018 at 8:47 am #4438baharsahin
ParticipantOkey if I use discrete for the first channel then I will use calculated discrete for the followings.
how does the software understand the queue, from channel numbers or from signal numbers? And What if the channel numbers of these are not sequential ? Is this a problem?
October 15, 2018 at 1:08 pm #4441Mikhail
ModeratorCould you provide an example?
Note: formulas are calculated in order of input channel numbers.October 15, 2018 at 1:25 pm #4442baharsahin
ParticipantFor example I have 2 registers for my digital inputs (1001-1002).
and their signal numbers are 354 and 355.I have digital inputs at input registers from 423 to 448 ( they are in order). They all have different signal numbers.
I selected channel type of the first digital input as discrete and the rest of them as calculated discrete. In this case, I can JUST read the value of register 1001’s 0th bit. The rest is not correct.When we add an element group to read registers, they have 1 unique signal number.
Then when I create input channels, I am creating 16 input channels to read 16 different bits of 1 register. Then how should I bound them?? It is reading just one bit of it.In communicator I can see that the register is just bound to one input channel but I want to give it to 16 input registers. How this is possible?
October 16, 2018 at 3:04 pm #4445Mikhail
ModeratorIn communicator I can see that the register is just bound to one input channel but I want to give it to 16 input registers. How this is possible?
One input channel is bound to only 1 tag in Communicator. For further calculations, you need to use one input channel (real type) as a source and other input channels of calculated type. If you post a link to a screenshot of your input channels, it would be easier to find a mistake.
October 26, 2018 at 3:24 pm #4506baharsahin
Participanthere is a screenshot of my input channel settings:
https://www.dropbox.com/s/sd5nljc5koxudz3/input%20channels.JPG?dl=0
October 26, 2018 at 6:27 pm #4508manjey73
Participantin Calculate Discrete – GetBit(Val(434),x)
October 28, 2018 at 7:55 am #4510Mikhail
ModeratorFix channel 434:
– No formula needed.
– Type is Real, because the channel contains a bit mask, not just one bit.Fix other channels:
– No Signal field needed.October 28, 2018 at 7:56 am #4511Mikhail
Moderatorin Calculate Discrete – GetBit(Val(434),x)
Yes. This is very important.
October 30, 2018 at 5:21 am #4518baharsahin
ParticipantI changed according to your advice : https://www.dropbox.com/s/sd5nljc5koxudz3/input%20channels.JPG?dl=0
But the results are still wrong.
I did not understand, why I dont need formula for channel 434. I want to assign the 8th bit of register 1001 to channel 434. and 9th bit of register 1001 to channel 435… continues likes this.
October 30, 2018 at 5:27 pm #4522Mikhail
ModeratorYou need to apply #4508
I did not understand, why I dont need formula for channel 434
Because if you get only 1 bit in the channel 434, you can’t reference 434 to calculate bits for other channels.
October 30, 2018 at 5:28 pm #4523Mikhail
Moderator434 is the source channel that have to be full as received from a device.
October 31, 2018 at 5:06 am #4527baharsahin
ParticipantI got the point now, thank you !
-
AuthorPosts
- You must be logged in to reply to this topic.