Announcement

Collapse
No announcement yet.

Cleaner way to do binary outputs?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts


  • Cleaner way to do binary outputs?

    I'm interfacing to some external lighting controllers that we've developed using binary inputs. 3 inputs with values of 1, 2 and 4, giving us a total of 8 scenes available to choose from. Only one scene should be able to be selected at any point and the outputs need to remain on to keep the scene running on the lighting controller.

    I could do something like the following using OR coils;
    Code:
    [Scene 1] ------ [Output 1]
    
    [Scene 2] ------ [Output 2]
    
    [Scene 3] ------ [Output 1]
                        |-- [Output 2]
    
    ......
    
    [Scene 7] ------ [Output 1]
                       |--- [Output 2]
                       |--- [Output 3]

    But that all seems really cludgy and I'd have to put in a bunch of NC tags as interlocks.

    How would you do it to be cleaner and more efficient?


  • #2
    for inputs, I copy (CPD) physical inputs to array elements, then work with the 'input' array, and for outputs, I work with 'output' array elements and then copy (CPD) the array elements to physical outputs.
    I do not know how to write 'words' to output cards (as a single word copy) in PxK.

    Maybe make a 'Word' tag that holds your OUTPUT image

    if Word == 1 then DO-0.1.1.1 will be on, all others off
    if Word == 3 then DO-0.1.1.1 and DO-0.1.1.2 will be on
    and if Word == 7 then DO-0.1.1.1, DO-0.1.1.2 and DO-0.1.1.3 will be on
    Code:
    .
    .
    . ------------------------+ CPD
    .                         | Word:1 DO-0.1.1.1
    .                         | Word:2 DO-0.1.1.2
    .                         | Word:3 DO-0.1.1.3
    .                         | Word:4 DO-0.1.1.4
    .                         | Word:5 DO-0.1.1.5
    .                         | Word:6 DO-0.1.1.6
    .                         | Word:7 DO-0.1.1.7
    .                         | Word:8 DO-0.1.1.8
    .                         | Word:9 DO-0.1.1.9
    .                         | Word:10 DO-0.1.1.10
    .                         | Word:11 DO-0.1.1.11
    .                         | Word:12 DO-0.1.1.12
    .                         | Word:13 DO-0.1.1.13
    .                         | Word:14 DO-0.1.1.14
    .                         | Word:15 DO-0.1.1.15
    .                         | Word:16 DO-0.1.1.16
    .                         +----------------------------------
    .
    Last edited by kewakl; 10-03-2019, 11:09 AM.

    Comment



    • #3
      Originally posted by kewakl View Post
      I do not know how to write 'words' to output cards (as a single word copy) in PxK.
      Dont you just use a single UnPack Bit instruction? You choose a word or dword as the source and then in the instruction you set each bit to the output you are controlling in hardware.

      Click image for larger version

Name:	UnPackBits.png
Views:	106
Size:	8.5 KB
ID:	125540


      Brandon_ You could use this method along with a Lookup Table to create your 8 scenes. Convert the binary to integer number and for each X store the corresponding integer number in that column of your table that makes the outputs you want on. Then to change scenes load the value of whichever X you want for the scene into the tables output tag. That tag is used as the source for the UnPack Bits instruction. That way every time you tell the lookup table to go to a different "X" it will update all your outputs. You can have more than 8 scenes this way as well, though you will be limited by number of scenes based on how many outputs you are using.


      There are wonderful tutorials on how to use lookup table stickied at the top of this subforum.

      Comment



      • #4
        Originally posted by MikeN View Post

        Dont you just use a single UnPack Bit instruction? You choose a word or dword as the source and then in the instruction you set each bit to the output you are controlling in hardware.
        Yes, I can do that. What I meant was -- like in CLICK.... COPY DS10 YD0. Simple. No bits. no manipulation. Nothing to list/iterate.

        [Edit] Mike's UPKB to physical outputs will do the same as my Bit of Word CPD example.
        You can embed binary values into the source words using Bit of Word-based instructions.

        In my example, I should have mentioned that the tag 'Word' would be the OP's 'scene' value. I used 'Word' to maintain the relationship of Word and Bit of Word
        Last edited by kewakl; 10-03-2019, 12:37 PM.

        Comment



        • #5
          Click image for larger version

Name:	binary cropped.jpg
Views:	66
Size:	48.6 KB
ID:	125568let your outputs mirror your inputs

          Comment



          • #6
            Click image for larger version

Name:	Capture.JPG
Views:	45
Size:	49.5 KB
ID:	125612

            Comment

            Working...
            X