13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Advanced Function <strong>Instruction</strong>FUN 62 P→HMSSECOND→HOUR:MINUTE:SECONDFUN 62 P→HMSConversion controlENLadder symbol62P. HMSS :D=0 Result as 0S :Starting register of second to be convertedD :Starting register storing result ofconversion (hour : minute : second)D :OVROver rangeOperandRangeWX WY WM WS TMR CTR HR IR OR SR ROR DR KWX0∣WX240WY0∣WY240WM0∣WM1896WS0∣WS984T0∣T255C0∣C255R0∣R3839R3840∣R3903R3904∣R3967R3968∣R4167R5000∣R8071D0∣D4095-117968399∣117964799S ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○• When conversion control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, will convert thesecond data from the S~S+1 32-bit register into the equivalent hour : minute : second time value and store itin the three successive registers D~D+2. All the data in this instruction is represented in binary (if there is anegative value it is represented using the 2's complement.)B15 B0 B15 B0S D (sec) -59 sec~59 secSecondS+1D+1 (min) -59 min~59 minB31 B16 D+2 (hr) -32768 hr~32767 hr↑The bit B31 of the secondregister is used as the signbit of the second value.↑The bits B15 of each register are used asthe sign bit of the hour : minute : secondvalue.• As shown in the diagram above, after convert to hour : minute : second value, the minute : second value canonly be in the range of -59 to 59, and the hour number can be in the range of -32768 to 32767 hours.Because of this, the maximum limit of D is -32768 hours, -59 minutes, -59 seconds to 32767 hours, 59minutes, 59 seconds, the corresponding second value of S which is in the range of -117968399 to117964799 seconds. If the S value exceeds this range, this instruction cannot be carried out, and will set theover range flag "OVR" to 1. If S = 0 then result is 0 flag "D = 0" will be set to 1.• The program in the diagram below is an example of this instruction. Please note that the content of theregisters are denoted by hexadecimal, and on the right is its equivalent value in decimal notation.X062P. HMSEN S : R 0D : R 10D=0OVRR0R15D17H0060H X0=6315287 secR10 002FH 47 secR11 000EH 14 minR12 06DAH 1754 hr7-42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!