Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: scott.lawrence on December 14, 2012, 09:49:16 AM

Title: Format Outputs?
Post by: scott.lawrence on December 14, 2012, 09:49:16 AM
Hi, I'm in the process of replacing a 260 cpu with a Do-More to take advantage of the new CTRIO2 modules. In the original application, I have to format 6 outputs in binary format (1-64) for schedule data to an ISA welder. Looking over the instructions in the Do-More, I don't see an OUTF. Is there another instruction for this? Or do I 'roll my own'?
Title: Re: Format Outputs?
Post by: franji1 on December 14, 2012, 10:36:44 AM
Try MOVER, e.g. MOVER "6 elements" from C10 (thru C15) to Y23 (thru Y28)

Or, if you are an expert with bit MATH operators
 & bitwise AND
 | bitwise OR
and possibly
 << shift left
 >>> unsigned shift right
you could do it inside MATH with UNSIGNED bit cast (e.g. C8:UB, look at C8 thru C15 as an UNSIGNED BYTE).
Title: Re: Format Outputs?
Post by: scott.lawrence on December 14, 2012, 10:46:20 AM
well, that would be ok, except the value is entered on the HMI as unsigned 16... in DirectSoft, I would then LD that value, BIN, then OUTF to the respective outputs to send the schedule  8)

seemed to suit my needs then, but the newer software has me scratching my head to do the same  ???
Title: Re: Format Outputs?
Post by: franji1 on December 14, 2012, 11:02:37 AM
You can cast a WORD to access its bit, e.g.

MOVER V100:2 6 Y23
would move V100, bit 2 (bit 0 is the LSBit, so this would be the 3rd bit) thru V100 bit 7 to Y23 thru Y28.
Title: Re: Format Outputs?
Post by: franji1 on December 14, 2012, 11:05:12 AM
No need for BIN conversion, though, unless it's BCD (you said unsigned 16, not BCD 16).  If it is BCD 16, then use
BCDTO V100 V101
then use V101 in your MOVER
MOVER V101:2 6 Y23
Title: Re: Format Outputs?
Post by: scott.lawrence on December 14, 2012, 11:28:49 AM
You can cast a WORD to access its bit, e.g.

MOVER V100:2 6 Y23
would move V100, bit 2 (bit 0 is the LSBit, so this would be the 3rd bit) thru V100 bit 7 to Y23 thru Y28.

that's what I was looking for! I did look over the cast format, as I'm using it to know when specific ranges of bits would be on. I just didn't read over enough of it  ::)

it's always the simple things that bite you in the  ;D