Posted 25 Feb 2016 I have a 16 position rotary selector switch I'm trying to program to a CQM1 PLC, that I will also be programming to a micrologix 1200 in the future, using CX Programmer. The switch connects to the PLC using 4 inputs, and activates the inputs in a binary pattern 0-16 as I turn the switch. For example: if the switch is wired to the first four inputs of the PLC, and is turned to "9" 0.0 and 0.3 will be activated and 0.1 and 0.2 will not, just like binary 9 = 1001. I have tried several things trying to get the PLC to accept these inputs as a single "data-point," and then convert to BCD or Hex to use in a timer. I'm having no luck! Does anyone have any ideas how this is done? The switch is a Tosoku DPP01 015L20RCB, and because of the age of the PLC my instruction set is limited. Thank you in advance! Share this post Link to post Share on other sites
Posted 25 Feb 2016 It seems as though you should be able to use the MOVD(83) instruction to copy those bits into a DM register and convert the register value to BCD for the timer preset. Share this post Link to post Share on other sites
Posted 25 Feb 2016 I agree with MendonSystems, another option: Since you are using bits 0-3, you can also use the ANDW instruction. ANDW 0 #000F DM100 This will and channel 0 with 0000 0000 0000 1111 and put the result in DM100. Then use the BCD instruction to convert the integer(binary) to BCD. BCD DM100 DM101 Then use DM101 as your timer preset. Share this post Link to post Share on other sites
Posted 25 Feb 2016 AND .... you'll probably need to do a little bit of simple math also. Just converting to BCD is only going to give you timer presets from 0 to 15. You'll most likely have to add 1 to get a range of 1 to 16 then multiply that by some constant to get the right timer scale. Share this post Link to post Share on other sites