Reading bits

Forum Home Forums Uncategorized Issues Reading bits

This topic contains 13 replies, has 3 voices, and was last updated by  baharsahin 2 weeks, 5 days ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #4425

    baharsahin
    Participant

    Hi,

    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?

    #4430
    Mikhail
    Mikhail
    Moderator

    Hi,

    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.

    #4438

    baharsahin
    Participant

    Okey 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?

    #4441
    Mikhail
    Mikhail
    Moderator

    Could you provide an example?
    Note: formulas are calculated in order of input channel numbers.

    #4442

    baharsahin
    Participant

    For 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?

    #4445
    Mikhail
    Mikhail
    Moderator

    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?

    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.

    #4506

    baharsahin
    Participant

    here is a screenshot of my input channel settings:

    https://www.dropbox.com/s/sd5nljc5koxudz3/input%20channels.JPG?dl=0

    #4508

    manjey73
    Participant

    in Calculate Discrete – GetBit(Val(434),x)

    #4510
    Mikhail
    Mikhail
    Moderator

    Fix 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.

    #4511
    Mikhail
    Mikhail
    Moderator

    in Calculate Discrete – GetBit(Val(434),x)

    Yes. This is very important.

    #4518

    baharsahin
    Participant

    I 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.

    #4522
    Mikhail
    Mikhail
    Moderator

    You 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.

    #4523
    Mikhail
    Mikhail
    Moderator

    434 is the source channel that have to be full as received from a device.

    #4527

    baharsahin
    Participant

    I got the point now, thank you !

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.