Chapter 6 Basic Function Instruction

Size: px
Start display at page:

Download "Chapter 6 Basic Function Instruction"

Transcription

1 Chapter 6 Basic Function Instruction T 6-2 C 6-5 SET 6-8 RST 6- : MC 6-2 : MCE 6-4 2: SKP 6-5 3: SKPE 6-7 4: DIFU 6-8 5: DIFD 6-9 6: BSHF 6-2 7: UDCTR 6-2 8: MOV : MOV/ 6-24 : TOGG 6-25 : (+) : (-) : (*) : (/) 6-3 5: (+) : (-) : CMP : AND : OR : BCD : BIN

2 T TIMER T Symbol TB: Time Base (.S,.S, S) Tn: Timer Number PV: Preset value of the timer. Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R384 R3839 R393 R394 R3967 R3968 R467 R5 R87 D D495 Tn PV The total number of timers is 256 (T~T255) with three different time bases,.s,.s and S.The default number and allocation of timers is shown as below (Can be adjusted according to user s actual requirements by the Configuration function): T~T49:.S timer(default as.~327.67s) T5~T99:.S timer(default as.~3276.7s) T2~T255:S timer(default as ~32767S) FBs-PLC programming tool will lookup the timer s time base automatically according to the Memory Configuration after the timer number is keyed in. Timer s time = Time base x Preset value. In the example below, the time base T =.S and the PV value =, therefore the T timer s time =.S x =.S. If PV is a register, then Timer s time = Time base x register content. Therefore, you only need to change the register content to change the timer s time. Please refer to Example 2. The maximum error of a timer is a time base plus a scan time. In order to reduce the timing error in the application, please use the timer with a smaller time base. When the time control is, the timer will start timing (the current value will accumulate from ) until Time Up (i.e. CV PV), then the Tn contact and TUP (FO) will change to. As long as the timer control input is kept as, even the CV of Tn has reached or exceeded the PV, the CV of the timer will continue accumulating (with M957 = ) until it reaches the maximum limit (32767). The Tn contact status and flag will remain as when CV PV, unless the input is. When input is, the CV of Tn will be reset to immediately and the Tn contact and Time Up flag TUP will also change to (please refer to the diagram below). If the FBS-PLC OS version is higher than V3. (inclusive), the M957 can be set to so the CV will not accumulate further after Time Up and stops at the PV value. The default value of the M957 is, therefore the status of M957 can be set before executing any timer instruction in the program to individually set the timer CV to continue accumulating or stop at the PV after Time Up (please refer to the diagram below). 6-2

3 T TIMER T Example Constant preset value Ladder diagram Key operations Mnemonic code X.S T TUP Y X T PV: X P SET M957.S T TUP FO Y SHORT SET M 957 An example of taking Time-Up signal directly from FO. X T PV: M957= (Defaulted) Y or X T (CV) T.S S M957= T (CV) T CV Time Start Time-Up Example 2 Variable PV The preset value (PV) shown in example is a constant which is equal to. This value is fixed and can not be changed once programmed. In many circumstances, the preset time of the timers needs to be varied while PLC running. In order to change the preset time of a timer, can first use a register as the PV operand (R or WX, WY...) and then the preset time can be varied by changing the register content. As shown in this example, if set R to, then T becomes a S Timer, and hence if set R to 2, then T becomes a 2S Timer. 6-3

4 T TIMER T Ladder diagram Key operations Mnemonic code X T5.S T5 R TUP Y X T 5 PV: R T 5 An example of applying the time-up status by using the T5 contact. Y X 2 T5 (current value) When R= Y.S When R=2 Y 2.S Time Start Time-Up Time-Up Remark: If the preset value of the timer is equal to, then the timer's contact status and FO (TUP) become ("" input must be at ) immediately after the PLC finishes its first scan because "Time-Up" has occurred. (TUP) stays at until "" input changes to. 6-4

5 C Symbol COUNTER (6-Bit: C~C99,32-Bit: C2~C255) Basic Function Instruction C Cn: The Counter number PV: Preset value Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D Cn PV There are total 2 6-Bit counters (C~C99). The range of preset value is between ~ C~C39 are Retentive Counters and the CV value will be retained when the PLC turns on or RUN again after a power failure or a PLC STOP. For Non Retentive Counters, if a power failure or PLC STOP occurs, the CV value will be reset to when the PLC turns on or RUN again. There are total Bit counters (C2~C255). The range of the preset value is between ~ C2~C239 are Retentive Counters and C24~C255 are Non Retentive Counters. The default number and assignment of the counters are shown below, if necessary can use the "CONFIGURATION" function to change the settings. To insure the proper counting, the sustain time of input status of CLK should greater than scan time. The max. counting frequency with this instruction can only up to 2Hz, for higher frequency please use the high-speed soft/hardware counter. When "CLR" is at, all of the contact Cn, FO (CUP), and CV value of the counter CV are cleared to and the counter stops counting. When "CLR" is at, the counter is allowed to count up. The Counter counts up every time the clock "CK " changes from to (adds to the CV) until the cumulative current value is equal to or greater than the preset value (CV>=PV), the counter "Count-Up" and the contact status of the counter Cn and FO (CUP) changes to. If the input status of clock continues to change, even the cumulative current value is equal and greater than the preset value, the CV value will still accumulate until it reaches the up limit at or The contact Cn and FO (CUP) stay at as long as CV>=PV unless the "CLR" input is set to.(please refer the diagram below) If the FBS-PLC OS version is higher than V3. (inclusive), the M973 can set to so the CV will not accumulate further after Count Up and stops at the PV. M973 default value is, therefore the status of M973 can be set before executing any counter instruction in the program to individually set the counter CV to continue accumulating or stops at the PV after Count Up (please refer to the diagram below). 6-5

6 C COUNTER (6-Bit: C~C99, 32-bit: C2~C255) C Example 6-Bit Fixed Counter Ladder diagram Key operations Mnemonic code SHORT X X PSU CLR RST C PV : M973 5 CUP Y LD RST M 973 X LD X C PV: 5 SET M973 X X PSU CLR C 2 PV : 5 CUP FO Y SHORT SET M 973 An example of applying the Count-Up status by using FO directly. LD X LD X C 2 PV: 5 X X M973= (Defaulted) M973= C Y C2 (CV) C times times 5 Count Start Count-Up Example 2 32-Bit counter with variable preset value Like a timer, if the PV of a counter is changed to a register (such as R, D, and so on), the counter will use the register contents as the counting PV. Therefore, only need to change the register contents to change the PV of the counter while PLC is running. Below is an example of a 32-bit counter that uses the data register R as the PV (in fact it is the 32-bit PV formed by R and R). 6-6

7 C COUNTER (6-Bit: C~C99, 32-Bit: C2~C255) C Ladder diagram Key operations Mnemonic code X C2 CUP X X CLR PV : R LD LD X C2 Y C2 PV: R C 2 An example of applying the time-up status by using the C2 contact. Y X X C (R=) When R=4 Y 4 times When R=9 Y 9 times Count Start Count-Up Count-Up Remark: If the preset value of the counter is and "CLR" input also at, then the Cn contact status and FO (CUP) becomes immediately after the PLC finishes its first scan because the "Count-Up" has occurred. It will stay at regardless how the CV value varies until "CLR" input changes to. 6-7

8 SET D P Symbol SET (Set coil or all the bits of register to ) SET D P D: destination to be set (the number of a coil or a register) Range Y M SM S WY WM WS TMR CTR HR OR SR ROR DR Y Y255 M M9 M92 M2 S S999 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R394 R3967 R3968 R467 R5 R87 D * * * D D495 When the set control "" = or from ( P instruction ), sets the bit of a coil or all bits of a register to. Example Single Coil Set Ladder Diagram Key Operations Mnemonic Codes X X P SET Y P RST Y SET RST P P X Y X Y X SET X RST Y 6-8

9 SET D P SET (Set coil or all the bits of register to ) Basic Function Instruction SET D P Example 2 Set 6-Bit Register Ladder Diagram Key Operations Mnemonic Codes X P SET R SET P X R B5 B D R X= B5 B D R Example 3 32-Bit Register Set Ladder Diagram Key Operations Mnemonic Codes X D SET R SET D X R B3 R R B D R X= D R 6-9

10 RST D P Symbol RESET (Reset the coil or the register to ) RST D P D: Destination to be reset (the number of a coil or a register) Range Y M SM S WY WM WS TMR CTR HR OR SR ROR DR Y Y255 M M9 M92 M2 S S999 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R394 R3967 R3968 R467 R5 R87 D * * * D D495 When the reset control "" = or from ( P instruction ), resets the coil or register to. Example Single Coil Reset Please refer to example for the SET instruction shown in page 6-8. Example 2 6-Bit Register Reset Ladder Diagram Key Operations Mnemonic Codes X RST P R 6-

11 RST D P RESET (Reset the coil or register to ) Basic Function Instruction RST D P B5 B D R X= B5 B D R Example 3 32-Bit Register Reset Ladder Diagram Key Operations Mnemonic Codes X D RST WM368 X RST D WM368 M399 WM384 WM368 M368 D WM368 X= D WM368 6-

12 FUN MC MASTER CONTROL LOOP START FUN MC Symbol Ladder symbol. N: Master Control Loop number (N=~27) Master control MC N the number N cannot be used repeatedly. There are a total of 28 MC loops (N=~27). Every Master Control Start instruction, MC N, must correspond to a Master Control End instruction, MCE N, which has the same loop number as MC N. They must always be used in pairs and you should also make sure that the MCE N instruction is after the MC N instruction. When the Master Control input "/" is, then this MC N instruction will not be executed, as it does not exist. When the Master Control input "/" is, the master control loop is active, the area between the MC N and MCE N is called the Master Control active loop area. All the status of coils or Timers within Master Control active loop area will be cleared to. Other instructions will not be executed. Example Ladder Diagram Key Operations Mnemonic Codes X X. MC Y FUN N: X X2 S T2 X Y T2 Y X 2 T2 PV: X. MCE Y2 T 2 Y FUN N: X Y 2 6-2

13 FUN MC MASTER CONTROL LOOP START FUN MC X X X2 T2 Y Y S Y2 Remark:MC/MCE instructions can be used in nesting or interleaving as shown to the right: Remark2: When M98= and the master input changes from, and if pulse type function instructions exist in the master control loop, then these instructions will have a chance to be executed only once (when the first time the master control input changes from ). Afterwards, no matter how many times the master control input changes from, the pulse type function instructions will not be executed again. When M98= and the master control input changes from, and if pulse type function instructions exist in the master control loop, then each time the master control input changes from the pulse type function instructions in the master control loop will be executed as long as the action conditions are satisfied. When a counting instruction exists in the master control loop, set M98 to can avoid counting error. When the pulse type function instructions in the master control loop must act upon the input change by the master control, the flag M98 should be set to. X X X2 MC MC MC MC MC MC. MC. MC 2. MC 3. MC 2. MC. MC 3 6-3

14 FUN MCE MASTER CONTROL LOOP D FUN MCE Symbol Ladder symbol. MCE N N: Master Control End number (N=~27) N can not be used repeatedly. Every MCE N must correspond to a Master Control Start instruction. They must always be used as a pair and you should also make sure that the MCE N instruction is after the MC N instruction. After the MC N instruction has been executed, all output coil status and timers will be cleared to and no other instructions will be executed. The program execution will resume until a MCE instruction which has the same N number as MC N instruction appears. MCE instruction does not require an input control because the instruction itself forms a network which other instructions can not connect to it. If the MC instruction has been executed then the master control operation will be completed when the execution of the program reaches the MCE instruction. If MC N instruction has never been executed then the MCE instruction will do nothing. Please refer to the example and explanations for MC instruction. 6-4

15 FUN 2 SKP Symbol SKIP START FUN 2 SKP Ladder symbol Skip control 2. SKP N N: Skip loop number (N=~27), N can not be used repeatedly. There are total 28 SKP loops (N=~27). Every skip start instruction, SKP N, must correspond to a skip end instruction, SKPE N, which has the same loop number as SKP N. They must always be used as a pair and you should also make sure that the SKPE N instruction is after the SKP N instruction. When the skip control "" is, then the Skip Start instruction will not be executed. When the skip control "" is, the range between the SKP N and SKPE N which is so called the Skip active loop area will be skipped, that is all the instructions in this area will not be executed. Therefore the statuses of the discrete or registers in this Skip active loop area will be retained. Example Ladder Diagram Key Operations Mnemonic Codes X X 2. SKP Y FUN N: X 2 X2 T2 S T2 Y X Y X 2 3. SKPE T2 PV: X Y2 T 2 Y FUN 3 N: X Y 2 6-5

16 FUN 2 SKP SKIP START FUN 2 SKP X X X2 T2 Y Y S Y2 6-6

17 FUN 3 SKPE SKIP D FUN 3 SKPE Symbol Ladder symbol 3. SKPE N N: SKIP D Loop number (N=~27) N can not be used repeatedly. Every SKPE N must correspond to a SKP N instruction. They must always be used as a pair and you should also make sure that the SKPE N instruction is behind the SKP N instruction. SKPE instruction does not require an input control because the instruction itself forms a network which other instructions can not connect to it. If the SKP N instruction has been executed then the skip operation will be completed when the execution of the program reaches the SKPE N instruction. If SKP N instruction has never been executed then the SKPE instruction will do nothing. Example Please refer to the example and explanations for SKP N instruction. Remark : SKP/SKPE instructions can be used by nesting or interleaving. The coding rules are the same as for the MC/MCE instructions. Please refer to the section of MC/MCE instructions. 6-7

18 FUN 4 DIFU Symbol DIFFERTIAL UP FUN 4 DIFU D: a specific coil number where the result of the Differential Up operation is stored. Range Y M SM S Y Y255 M M9 M92 M2 S S999 D * The DIFU instruction is used to output the up differentiation of a node status (status input to "TGU") and the pulse signal resulting from the status change at the rising edge of the "TGU" for one scan time is stored to a coil specified by D. The functionality of this instruction can also be achieved by using a TU contact. Example The results of the following two samples are exactly the same Ladder Diagram Key Operations Mnemonic Codes Example X TGU 4P. DIFU Y FUN FUN X 4 D: Y Example 2 X Y TU X Y X t t : scan time Y 6-8

19 FUN 5 P DIFD Symbol DIFFERTIAL DOWN FUN 5 P DIFD N: a specific coil number where the result of the Differential Down operation is stored. Range Y M SM S Y Y255 M M9 M92 M2 S S999 D * The DIFD instruction is used to output the down differentiation of a node status (status input to "TGD") and the pulse signal resulting from the status change at the falling edge of the "TGD" for one scan time is stored to a coil specified by D. The functionality of this instruction can also be achieved by using a TD contact. Example The results of the following two samples are exactly the same Ladder Diagram Key Operations Mnemonic Codes Example X TGD 5P. DIFD Y FUN X FUN 5 D: Y Example 2 X Y TD X Y X t t : scan time Y 6-9

20 FUN 6 D P BSHF Symbol BIT SHIFT (Shifts the data of the 6-bit or 32-bit register to left or to right by one bit) FUN 6 D P BSHF D: The register number for shifting Range WY WM WS TMR CTR HR OR SR ROR DR WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R394 R3967 R3968 R467 R5 R87 D D495 D * * When the status of clear control "CLR" is at, then the data of register D and FO will all be cleared to. Other input signals are all in effect. When the status of clear control is "CLR" at, then the shift operation is permissible. When the shift control "" = or from ( P instruction), the data of the register will be shifted to right (L/R=) or to left (L/R=) by one bit. The shifted-out bit (MSB when shift to left and LSB when shift to right) for both cases will be sent to FO. The vacated bit space (LSB when shift to left and MSB when shift to right) due to shift operation will be filled in by the input status of fill-in bit "INB". Example Shifts the 6-bit register data Ladder diagram Key Operations Mnemonic Codes X X X2 INB 6P.BSHF D : R 3 OTB Y LD LD LD LD X 2 LD X 3 LD X 4 X3 X4 L/R CLR FUN FUN 6P D: R 3 FO Y X3= (Left shift) X3= (Right shift) B5 B Y Shifts the 6-bit data to left by one bit X2 B5 B X2 Shifts the 6-bit data to right by one bit Y 6-2

21 FUN 7 D P UDCTR Symbol UP/DOWN COUNTER (6-bit or 32-bit up and down 2-phase Counter) Basic Function Instruction FUN 7 D P UDCTR CV: The number of the Up/Down Counter PV: Preset value of the counter or it's register number Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K WX WY WM WS T C R R384 R394 R3968 R5 D Ope- rand WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 CV * * 6/32-bit +/ number PV When the clear control CLR is, the counter s CV will be reset to and the counter will not be able to count. When the clear control CLR is, counting will then be allowed. The nature of the instruction is a P instruction. Therefore, when the count-pulse PLS is from (rising edge), the CV will increased by (if U/D=) or decreased by (if U/D=). When CV=PV, FO( Count-Up) will change to. If there are more clocks input, the counter will continue counting which cause CV PV. Then, FO will immediately change to. This means the Count-Up signal will only be equal to if CV=PV, or else it will be equal to (Care should be taken to this difference from the Count-Up signal of the general counter). The upper limit of up count value is (6-bit) or (32-bit). After the upper limit is reached, if another up count clock is received, the counting value will become or (the lower limit of down count). The lower limit of down count value is (6-bit) or (32-bit). After the lower limit is reached, if another down count clock is received, the counting value will become or (the upper limit of up count). If U/D is fixed as, the instruction will become a single-phase up count counter. If U/D is fixed as, the instruction will become a single-phase down count counter. 6-2

22 FUN 7 D P UDCTR UP/DOWN COUNTER (6-bit or 32-bit up/down 2-phase Counter) FUN 7 D P UDCTR Ladder Diagram Key Operations Mnemonic Codes X8 X7 PSU U/D 7P.UDCTR CV : PV : R - 3 CUP Y LD LD X 8 LD X 7 LD X 6 FUN 7 X6 CLR CV: R PV: 3 FO Y Up(add) Down(subtract) X6 X7 X8 R Y Remark : Since the counting operation of UDCTR is implemented by software scanning, therefore if the clock speed is faster than the scan speed, lose count may then happen (generally the clock should not exceed 2Hz depending on the size of the program). Please use the software or hardware high-speed counter in the PLC. Refer to the High Speed Counter Application in the Advanced Manual. Remark 2: In order to ensure the proper counting, the sustain time of the status of clock input should greater than scan time. 6-22

23 FUN 8 D P MOV MOVE (Moves data from S to D) Basic Function Instruction FUN 8 D P MOV Move control Ladder symbol 8DP.MOV S : D : S: Source register number D: Destination register number The S, N, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number P~P9 S D * * V Z Move (write) the data of S to a specified register D when the move control input "" = or from to ( P instruction). Example Writes a constant data into a 6-bit register. Ladder Diagram Key Operations Mnemonic Codes X 8P.MOV S : D : R X FUN 8P S: D: R S K X= D R 6-23

24 FUN 9 D P MOV/ Symbol MOVE INVERSE (Inverts the data of S and moves the result to a specified device D) FUN 9 D P MOV/ Move control Ladder symbol 9DP.MOV/ S : D : S: Source register number D: Destination register number S, N, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R3847 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number P~P9 S D * * V Z Inverts the data of S (changes the status from to and from to ) and moves the results to a specified register D when the move control input "" = or from to ( P instruction). Example Moves the inverted data of a 6-bit register to another 6-bit register. Ladder Diagram Key Operations Mnemonic Codes X 9.MOV/ S : R D : WY 8 X FUN 9 S: R D: WY 8 B5 S R 5555H B Y23 X= D WY8 AAAAH Y8 6-24

25 FUN TOGG Symbol TOGGLE SWITCH (Changes the output status when the rising edge of control input occur) FUN TOGG D: the coil number of the toggle switch Range Y M SM S Y Y255 M M92 M9 M2 S S999 D * The coil D changes its status (from to and from to ) each time the input "TGU" is triggered from to (rising edge). Example Ladder Diagram Key Operations Mnemonic Codes X TGU P. TOGG Y X FUN D: Y X Y 6-25

26 FUN D P (+) Symbol ADDITION (Performs addition of the data specified at Sa and Sb and stores the result in D) FUN D P (+) Sa: Augend Sb: Addend D : Destination register to store the results of the addition Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number Sa Sb D * * V Z P~P9 Performs the addition of the data specified at Sa and Sb and writes the results to a specified register D when the add control input "" = or from to ( P instruction). If the result of addition is equal to then set FO to. If carry occurs (the result exceeds or ) then set FO to. If borrow occurs (adding negative numbers resulting in a sum less than or ), then set the FO2 to. All the FO statuses are retained until this instruction is executed again and overwritten by a new result. Example 6-bit addition Ladder Diagram Key Operations Mnemonic Codes X U/S P.(+) Sa : R Sb : R D : R 2 D= CY Y X FUN P Sa: R Sb: R BR D: R 2 FO Y Sa R 2345 Sb R 2425 R+R=3277 X= D R =3277 Y= (carry represents ) 6-26

27 FUN 2 D P ( ) Symbol SUBTRACTION (Performs subtraction of the data specified at Sa and Sb and stores the result in D) FUN 2 D P ( ) Ladder symbol 2DP.(-) Sa : Subtraction control D= Unsign/Sign U/S Sb : D : CY BR Difference=(FO) Carry(FO) Borrow(FO2) Sa: Minuend Sb: Subtrahend D : Destination register to store the results of the subtraction Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number Sa Sb D * * V Z P~P9 Performs the subtraction of the data specified at Sa and Sb and writes the results to a specified register D when the subtract control input "" = or from to ( P instruction). If the result of subtraction is equal to then set FO to. If carry occurs (subtracting a negative number from a positive number and the result exceeds or ), then set FO to. If borrow occurs (subtracting a positive number from a negative number and the resulted difference is less than or ), then set FO2 to. All the FO statuses are retained until this instruction is executed again and overwritten by a new result. Example 6-bit subtraction Ladder Diagram Key Operations Mnemonic Codes X X 2P.(-) U/S Sa : Sb : D : R R R 2 D= CY BR Y2 FUN 2 Sa: R Sb: R D: R 2 FO 2 Y 2 Sa R -5 Sb R R-R= X= D R = Y2=(borrow represents-32768)please refer to section

28 FUN 3 D P (*) Symbol MULTIPLICATION (Performs multiplication of the data specified at Sa and Sb and stores the result in D) FUN 3 D P (*) Ladder symbol 3DP.(*) Sa : Mutiplication control D= Unsign/Sign U/S Sb : D : Product=(FO) D< Product is negative (FO) Sa: Multiplicand Sb: Multiplier D : Destination register to store the results of the multiplication. Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number Sa Sb D * * V Z P~P9 Performs the multiplication of the data specified at Sa and Sb and writes the results to a specified register D when the multiplication control input "" = or from to ( P instruction). If the product of multiplication is equal to then set FO to. If the product is a negative number, then set FO to. Example 6-bit multiplication Ladder Diagram Key Operations Mnemonic Codes X X U/S 3P.(*) Sa : R Sb : R D : R 2 D= D< FUN 3P Sa: R Sb: R D: R 2 Sa Sb R 2345 R 4567 Multiplicand Multiplier D R R2 Product 6-28

29 FUN 3 D P (*) MULTIPLICATION (Performs multiplication of the data specified at Sa and Sb and stores the result in D) FUN 3 D P (*) Example 2 32-bit multiplication Ladder Diagram Key Operations Mnemonic Codes X X U/S 3D.(*) Sa : R Sb : R D : R 2 4 D= D< FUN 3D Sa: R Sb: R 2 D: R 4 Sa R R Multiplicand Sb R3 R2 Multiplier D R7 R6 R5 R Product 6-29

30 FUN 4 D P (/) Symbol DIVISION (Performs division of the data specified at Sa and Sb and stores the result in D) FUN 4 D P (/) Ladder symbol 4DP.(/) Division control Sa : D= Sb : Unsign/Sign U/S D : ERR Quotient= (FO) Divisor is (FO) Sa: Dividend Sb: Divisor D : Destination register to store the results of the division. Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WX24 WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R384 R393 R394 R3967 R3968 R467 R5 R87 D D495 6/32-bit +/ number Sa Sb D * * V Z P~P9 Performs the division of the data specified at Sa and Sb and writes the quotient and remainder to registers specified by register D when the division control input "" = or from to ( P instruction). If the quotient of division is equal to then set FO to. If the divisor Sb= then set the error flag FO to without executing the instruction. Example 6-bit division Ladder Diagram Key Operations Mnemonic Codes X U/S 4P.(/) Sa: R Sb: R D : R 2 D= ERR X FUN 4 Sa: R Sb: R D: R 2 Sa Sb R 256 R 2 Dividend Divisor D R3 R2 4 2 Remainder Quotient 6-3

31 FUN 4 D P (/) DIVISION (Performs division of the data specified at Sa and Sb and stores the result in D) FUN 4 D P (/) Example 2 32-bit division Ladder Diagram Key Operations Mnemonic Codes X 4D.(/) Sa: R Sb: R 2 D= X FUN 4D Sa: R U/S D : R 4 ERR Sb: R 2 D: R 4 Sa R R Dividend Sb R R2 Divisor D R7 R6 R5 R Remainder Quotient 6-3

32 FUN 5 D P (+) INCREMT (Adds to the D value) FUN 5 D P (+) D : The register to be increased D may combine with V, Z, P~P9 to serve indirect addressing Range WY WM WS TMR CTR HR OR SR ROR DR XR WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R394 R3967 R3968 R467 R5 R87 D D495 V Z P~P9 D * * Adds to the register D when the increment control input "" = or from to ( P instruction). If the value of D is already at the upper limit of positive number or , adding one to this value will change it to the lower limit of negative number or At the same time, the overflow flag FO (OVF) is set to. Example 6-bit increment register Ladder diagram Key operations Mnemonic code TU X X 5P. (+) R V OVF FUN 5 D : R V When V=,+= D R X= D R

33 FUN 6 D P (-) DECREMT (Subtracts from the D value) FUN 6 D P (-) Ladder symbol 6DP. Decrement control (-) D UDF Underflow(FO) D : The register to be decreased D may combine with V, Z, P~P9 to serve indirect addressing Range WY WM WS TMR CTR HR OR SR ROR DR XR WY WY24 WM WM896 WS WS984 T T255 C C255 R R3839 R394 R3967 R3968 R467 R5 R87 D D495 V Z P~P9 D * * Subtracts from the register D when the decrement control input "" = or from to ( P instruction). If the value of D is already at the lower limit of negative number or , subtracting one from this value will change it to the upper limit of positive number or At the same time, the underflow flag FO (UDF) is set to. Example 6-bit decrement register Ladder diagram Key operations Mnemonic code X X 6P. (-) R UDF FUN 6P D : R D R X= D R

34 FUN 7 D P CMP COMPARE (Compares the data of Sa and Sb and outputs the results to function Outputs) FUN 7 D P CMP Ladder symbol 7DP.CMP Compare control Sa : a = b Sa=Sb (FO) Sa: The register to be compared Unsign/Sign U/S Sb : a > b Sa>Sb (FO) Sb: The register to be compared Sa, Sb may combine with V, Z, P~P9 to serve indirect addressing a < b Sa<Sb (FO2) Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WY WM WS T C R R384 R394 R3968 R5 D 6/32 bit V Z Ope- rand +/-number WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 P~P9 Sa Sb Compares the data of Sa and Sb when the compare control input "" = or from to ( P instruction). If the data of Sa is equal to Sb, then set FO to. If the data of Sa>Sb, then set FO to. If the data of Sa<Sb, then set FO2 to. If the data of Sa < Sb, then set the FO2 to. Example Compares the data of 6-bit register Ladder diagram Key operations Mnemonic code X 7.CMP X U/S Sa : Sb : R R a=b a>b Y FUN 7 Sa : R Sb : R a<b FO 2 Y From the above example, we first assume the data of R is and R is 2, and then compare the data by executing the CMP instruction. The FO and FO are set to and FO2 (a<b) is set to since a<b. If you want to have the compound results, such as < > etc., please send = < and > results to relay first and then combine the result from the relays. M99=, when this command in not executed, FO, FO, FO2 will remain in the status at last execution. M99=, when this command in not executed, FO, FO, FO2 are all cleared to. Control M99 properly to obtain memory-holding function for functional command output. 6-34

35 FUN 8 D P AND LOGICAL AND FUN 8 D P AND Sa: The register to be ANDed Sb: The register to be ANDed D : The register to store the result of AND The Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing application Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WY WM WS T C R R384 R394 R3968 R5 D 6/32 bit V Z Ope- rand +/-number WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 P~P9 Sa Sb D * * Performs logical AND operation for the data of Sa and Sb when the operation control input "" = or from to ( P instruction). This operation compares the corresponding bits of Sa and Sb (B~B5 or B~B3). The bit in the D is set to if both of the corresponding bits data of Sa and Sb is. The bit in the D is set to if one of the corresponding bits is. Example Operation of 6-bit logical AND Ladder diagram Key operations Mnemonic code X X 8P.AND Sa : R Sb : R D= FUN 8P Sa : R D : R 2 Sb : R D : R 2 B5 B Sa R Sb R X= B5 B D R2 6-35

36 FUN 9 D P OR LOGICAL OR FUN 9 D P OR Sa: The register to be ORed Sb: The register to be ORed D : The register to store the result of OR The Sa, Sb, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WY WM WS T C R R384 R394 R3968 R5 D 6/32 bit V Z Ope- rand +/-number WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 P~P9 Sa Sb D * * Performs logical OR operation for the data of Sa and Sb when the operation control input "" = or from to ( P instruction). This operation compares the corresponding bits of Sa and Sb (B~B5 or B~B3). The bit in the D is set to if one of the corresponding of Sa or Sb is. The bit in the D is set to if both of the corresponding bits of Sa and Sb is. Example Operation of 6-bit logical OR Ladder diagram Key operations Mnemonic code X 9.OR Sa : Sb : R R D= X FUN 9 Sa : R D : R 2 Sb : R D : R 2 B5 B Sa R Sb R X= B5 B D R2 6-36

37 FUN 2 D P BCD BIN TO BCD CONVERSION (Converts BIN data of the device specified at S into BCD and stores the result in D) FUN 2 D P BCD S : The register to be converted D : The register to store the converted data (BCD code) The S, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR WX WY WM WS T C R R384 R394 R3968 R5 D 6/32 bit V Z Ope- +/- number rand WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 P~P9 S D * * FB-PLC uses binary code to store and to execute calculations. If want to send the internal PLC data to the external displays such as seven-segment displays, it is more convenient for us to read the result on screen by converting the BIN data to BCD data. For example, it is more clear for us to read the reading "2" instead of the binary code "." Converts BIN data of the device specified at S into BCD and writes the result in D when the operation control input "" = or from to ( P instruction). If the data in S is not a BCD value (~9999 or ~ ), then the error flag FO is set to and the old data of D are retained. Example 6-bit BIN to BCD conversion Ladder diagram Key operations Mnemonic code X 2. BCD S : 9999 D : R ERR X FUN 2 S : 9999 D : R B5 B S K X= B5 B D R 6-37

38 FUN 2 D P BIN BCD TO BIN CONVERSION (Converts BCD data of the device specified at S into BIN and stores the result in D) FUN 2 D P BIN S : The register to be converted D : The register to store the converted data (BIN code) The S, D may combine with V, Z, P~P9 to serve indirect addressing Range WX WY WM WS TMR CTR HR IR OR SR ROR DR XR WX WY WM WS T C R R384 R394 R3968 R5 D V Z WX24 WY24 WM896 WS984 T255 C255 R3839 R393 R3967 R467 R87 D495 P~P9 S D * * The decimal (BCD) data must be converted to binary (BIN) data first in order for PLC to accept the data which is originally in decimal unit (BCD code) inputted from external device such as digital switch because the BCD data can not be accepted by PLC for its operations. Converts BCD data of the device specified at S into BIN and writes the result in D when the operation control input "" = or from to ( P instruction). If the data in S is not in BCD, then the error flag FO is set to and the old data of D are retained. Constant is converted to BIN automatically when store in program and can not be used as a source operand of this function. Example 6-bit BCD to BIN conversion Ladder diagram Key operations Mnemonic code X 2P. BIN S : WX D : R ERR X FUN 2P S : WX D : R X5 X S WX X= B5 B D R 6-38

Chapter 6 Descriptions of Function Instructions

Chapter 6 Descriptions of Function Instructions Chapter 6 Descriptions of Function Instructions 6.1 The Format of Function Instructions In this chapter we will introduce the function instructions of FB-PLC in details. All the explanations for each function

More information

Chapter 5 Descriptions of Function Instructions

Chapter 5 Descriptions of Function Instructions Chapter 5 Descriptions of Function Instructions 5.1 The Format of Function Instructions In this chapter we will introduce the function instructions of FBs-PLC in details. All the explanations for each

More information

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Chapter 5: Computer Arithmetic. In this chapter you will learn about: Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction (-) Multiplication

More information

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Learning Objectives. Binary over Decimal. In this chapter you will learn about: Ref Page Slide 1/29 Learning Objectives In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations using binary numbers Addition (+) Subtraction

More information

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Binary Addition. Add the binary numbers and and show the equivalent decimal addition. Binary Addition The rules for binary addition are 0 + 0 = 0 Sum = 0, carry = 0 0 + 1 = 0 Sum = 1, carry = 0 1 + 0 = 0 Sum = 1, carry = 0 1 + 1 = 10 Sum = 0, carry = 1 When an input carry = 1 due to a previous

More information

easyladder The PLC engine for your Raspberry Pi User manual

easyladder The PLC engine for your Raspberry Pi User manual easyladder The PLC engine for your Raspberry Pi User manual Contents 1. Introduction... 4 2. Requirements... 5 3. PLC engine... 6 3.1. Introduction to ladder programming... 6 3.2. PLC devices... 8 3.2.1.

More information

carry in carry 1101 carry carry

carry in carry 1101 carry carry Chapter Binary arithmetic Arithmetic is the process of applying a mathematical operator (such as negation or addition) to one or more operands (the values being operated upon). Binary arithmetic works

More information

Chapter 5: Computer Arithmetic

Chapter 5: Computer Arithmetic Slide 1/29 Learning Objectives Computer Fundamentals: Pradeep K. Sinha & Priti Sinha In this chapter you will learn about: Reasons for using binary instead of decimal numbers Basic arithmetic operations

More information

Instruction. Contents

Instruction. Contents Instruction Contents Chapter 1: PLC Ladder Diagram and the Coding Rules of Mnemonic 1.1 The Operation Principle of Ladder Diagram... 1-1 1.1.1 Combination Logic... 1-1 1.1.2 Sequential Logic... 1-2 1.2

More information

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem   ahmadsm AT kfupm Phone: Office: COE 0: Digital Logic Design Number Systems Part Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: -34 Objectives Arithmetic operations: Binary number system Other number systems Base Conversion

More information

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers

More information

Chapter 11 FB-PLC High-Speed Counter and Timer

Chapter 11 FB-PLC High-Speed Counter and Timer Chapter 11 FB-PLC High-Speed Counter and Timer 11.1 FB-PLC High-Speed Counter The counting frequency of an ordinary PLC s software counter can only reach tens of Hz (depending on the scan time). If the

More information

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes Digital Fundamentals CHAPTER 2 Number Systems, Operations, and Codes Decimal Numbers The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Ladder diagram instructions

Ladder diagram instructions diagram instructions Introduction "" is the most frequent method of programming PLC controllers at present. We could divide instructions on the input ones for stating the conditions and the output ones

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS Addition of Unsigned Numbers The instruction ADD is used to add two operands Destination operand is always in register A Source operand can be a register,

More information

SA3-PLC Function Instruction Manual

SA3-PLC Function Instruction Manual SA3-PLC Function Instruction Manual CONTENTS 1. PLC Function Application... 1 1.1 PLC Introduction... 1 1.2 The note of using the PLC function... 1 1.3 System Configuration... 2 1.3.1 Editing Tools...

More information

Instruction. Chapter 1 PLC Ladder Diagram and the Coding Rules of Mnemonic

Instruction. Chapter 1 PLC Ladder Diagram and the Coding Rules of Mnemonic Instruction Chapter 1 PLC Ladder Diagram and the Coding Rules of Mnemonic In this chapter, we would like to introduce you the basic principles of ladder diagram, in addition, the coding rules of Mnemonic

More information

MECH 1500 Quiz 4 Review

MECH 1500 Quiz 4 Review Class: Date: MECH 1500 Quiz 4 Review True/False Indicate whether the statement is true or false. 1. For the timer relay contact shown, when the relay coil is energized, there is a time delay before the

More information

D I G I T A L C I R C U I T S E E

D I G I T A L C I R C U I T S E E D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,

More information

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B) COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant

More information

ENE 334 Microprocessors

ENE 334 Microprocessors Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST III Date : 21/11/2017 Max Marks : 40 Subject & Code : Computer Organization (15CS34) Semester : III (A & B) Name of the faculty: Mrs. Sharmila Banu Time : 11.30 am 1.00 pm Answer

More information

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

More information

PLC Programming D R. T A R E K A. T U T U N J I

PLC Programming D R. T A R E K A. T U T U N J I PLC Programming D R. T A R E K A. T U T U N J I PLC Programming As PLCs developed and expanded, programming languages have developed with them. The three types of programming languages used in PLCs are:

More information

8051 Overview and Instruction Set

8051 Overview and Instruction Set 8051 Overview and Instruction Set Curtis A. Nelson Engr 355 1 Microprocessors vs. Microcontrollers Microprocessors are single-chip CPUs used in microcomputers Microcontrollers and microprocessors are different

More information

Chapter 4 Sequential Instructions

Chapter 4 Sequential Instructions Chaper 4 Sequenial Insrucions The sequenial insrucions of FBs-PLC shown in his chaper are also lised in secion 3.. Please refer o Chaper, "PLC Ladder diagram and he Coding rules of Mnemonic insrucion",

More information

1 General Information

1 General Information 2013 PLC 1 General Information Controller configuration: main block Visio V230-13-B20 standard version addit. module Snap-in I/0 V200-18-E1B or V200-18-E2B Program uses operands with fixed addresses: I

More information

Numbering systems. Dr Abu Arqoub

Numbering systems. Dr Abu Arqoub Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another

More information

3 Basic Program Instructions

3 Basic Program Instructions 3 Basic Program Instructions In this chapter, we tell the basic instructions and their functions. 3-1.Basic Instructions List 3-2.[], [I], [] 3-3.[AN], [ANI] 3-4.[OR], [ORI] 3-5.[P], [F], [ANP], [ANF],

More information

Automating with STEP 7 in STL

Automating with STEP 7 in STL Automating with STEP 7 in STL SIMATICS 7-300/400 Programmable Controllers by Hans Berger Publicis MCD Verlag Contents Introduction 16 1 SIMATIC S 7-300/400 Programmable Controller 17 1.1 Structure of the

More information

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error

More information

Arithmetic and Logic Instructions And Programs

Arithmetic and Logic Instructions And Programs Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.

More information

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

ET355 Microprocessors Thursday 6:00 pm 10:20 pm ITT Technical Institute ET355 Microprocessors Thursday 6:00 pm 10:20 pm Unit 4 Chapter 6, pp. 139-174 Chapter 7, pp. 181-188 Unit 4 Objectives Lecture: BCD Programming Examples of the 805x Microprocessor

More information

Chapter 13 The Applications for FB-PLC Link Function

Chapter 13 The Applications for FB-PLC Link Function Chapter 13 The Applications for FB-PLC Link Function As previously revealed in Chapter 12 that the FB-PLCs connect through the two communication ports - port1 or port2 - to make multi_drop link operation

More information

Chapter 4 Section 2 Operations on Decimals

Chapter 4 Section 2 Operations on Decimals Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.

More information

COMPUTER ARITHMETIC (Part 1)

COMPUTER ARITHMETIC (Part 1) Eastern Mediterranean University School of Computing and Technology ITEC255 Computer Organization & Architecture COMPUTER ARITHMETIC (Part 1) Introduction The two principal concerns for computer arithmetic

More information

Contents 8051 Instruction Set BY D. BALAKRISHNA, Research Assistant, IIIT-H Chapter I : Control Transfer Instructions Lesson (a): Loop Lesson (b): Jump (i) Conditional Lesson (c): Lesson (d): Lesson (e):

More information

Principle and Interface Techniques of Microcontroller

Principle and Interface Techniques of Microcontroller Principle and Interface Techniques of Microcontroller --8051 Microcontroller and Embedded Systems Using Assembly and C LI, Guang ( 李光 ) Prof. PhD, DIC, MIET WANG, You ( 王酉 ) PhD, MIET 杭州 浙江大学 2011 Chapter

More information

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010 Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER

More information

TRANSISTORIZED INVERTER

TRANSISTORIZED INVERTER TRANSISTORIZED INVERTER FR-C500 PROGRAMMING MANUAL OVERVIEW Chapter 1 SEQUENCE PROGRAM LANGUAGES AND OPERATIONS Chapter 2 DESCRIPTION OF DEVICES Chapter 3 PLC FUNCTION Chapter 4 STRUCTURES OF INSTRUCTIONS

More information

Special Memory (SM) Bits

Special Memory (SM) Bits C Special memory bits provide a variety of status and control functions, and also serve as a means of communicating information between the CPU and your program. Special memory bits can be used as bits,

More information

BINARY SYSTEM. Binary system is used in digital systems because it is:

BINARY SYSTEM. Binary system is used in digital systems because it is: CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System

More information

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division

More information

Chapter 5 : Computer Arithmetic

Chapter 5 : Computer Arithmetic Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit

More information

Industrial Automation de Processos Industriais)

Industrial Automation de Processos Industriais) Industrial Automation (Automação de Processos Industriais) PLC Programming languages Ladder Diagram http://users.isr.ist.utl.pt/~jag/courses/api1516/api1516.html Slides 2010/2011 Prof. Paulo Jorge Oliveira

More information

Chapter 10 - Computer Arithmetic

Chapter 10 - Computer Arithmetic Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation

More information

Windows PLC. Leading Numerical Controller. 2008/2 Ver:V ( ) LNC Technology Co., Ltd. LNC CORP., LTD.

Windows PLC. Leading Numerical Controller. 2008/2 Ver:V ( ) LNC Technology Co., Ltd. LNC CORP., LTD. Programmer Manual 2008/2 Ver:V04.00.000(4408420002) Leading Numerical Controller LNC Technology Co., Ltd. LNC CORP., LTD. I Table of Content Table of Content 1 INTRODUCTION OF BUILT-IN PLC SOFTWARE...1

More information

TYPES OF INTERRUPTS: -

TYPES OF INTERRUPTS: - There are 3 types of interrupts. TYPES OF INTERRUPTS: - External Interrupts. Internal Interrupts. Software interrupts. Hardware Interrupts (1) External interrupts come from I/O devices, from a timing device

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

Number representations

Number representations Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

More information

Logic design Ibn Al Haitham collage /Computer science Eng. Sameer

Logic design Ibn Al Haitham collage /Computer science Eng. Sameer DEMORGAN'S THEOREMS One of DeMorgan's theorems stated as follows: The complement of a product of variables is equal to the sum of the complements of the variables. DeMorgan's second theorem is stated as

More information

8088/8086 Programming Integer Instructions and Computations

8088/8086 Programming Integer Instructions and Computations Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction

More information

MIPS Integer ALU Requirements

MIPS Integer ALU Requirements MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set

More information

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B) Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,

More information

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital hardware modules that accomplish a specific information-processing task. Digital systems vary in

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted

More information

PLC AUTOMATION SYSTEM LABORATORY. Manual

PLC AUTOMATION SYSTEM LABORATORY. Manual MRS AVN COLLEGE POLYTECHNIC VISAKHAPATNAM DEPARTMENT OF ELECTRICAL ELECTRONICS ENGINEERING PLC AUTOMATION SYSTEM LABORATORY Manual PLC Automation System Laboratory Lab 1 : Getting familiar with Step 7-

More information

II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Answer ONE question from each unit.

II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Answer ONE question from each unit. Hall Ticket Number: 14CS IT303 November, 2017 Third Semester Time: Three Hours Answer Question No.1 compulsorily. II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION Common for CSE & IT Digital Logic

More information

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS C H A P T E R 6 DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS OUTLINE 6- Binary Addition 6-2 Representing Signed Numbers 6-3 Addition in the 2 s- Complement System 6-4 Subtraction in the 2 s- Complement

More information

Lecture 8: Addition, Multiplication & Division

Lecture 8: Addition, Multiplication & Division Lecture 8: Addition, Multiplication & Division Today s topics: Signed/Unsigned Addition Multiplication Division 1 Signed / Unsigned The hardware recognizes two formats: unsigned (corresponding to the C

More information

NUMBER SCALING FOR THE LGP-27

NUMBER SCALING FOR THE LGP-27 NUMBER SCALING FOR THE LGP-27 5 SCALING The LGP-21 considers all numbers to be within the range -l

More information

8051 Programming: Arithmetic and Logic

8051 Programming: Arithmetic and Logic 8051 Programming: Arithmetic and Logic EE4380 Fall 2002 Class 4 Pari vallal Kannan Center for Integrated Circuits and Systems University of Texas at Dallas Topics Signed and Unsigned arithmetic Binary

More information

Computer Organization and Technology Processor and System Structures

Computer Organization and Technology Processor and System Structures Computer Organization and Technology Processor and System Structures Assoc. Prof. Dr. Wattanapong Kurdthongmee Division of Computer Engineering, School of Engineering and Resources, Walailak University

More information

1 Program Summary. 1-1.Programmer Controller s Features. 1-2.Program Language. 1-3.Program Format

1 Program Summary. 1-1.Programmer Controller s Features. 1-2.Program Language. 1-3.Program Format 1 Program Summary XC series PLC as the controllers, accept the signal and execute the program in the controller, to fulfill the requirements from the users. In this chapter, we start with the program forms,

More information

Number Systems Base r

Number Systems Base r King Fahd University of Petroleum & Minerals Computer Engineering Dept COE 2 Fundamentals of Computer Engineering Term 22 Dr. Ashraf S. Hasan Mahmoud Rm 22-44 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23

More information

Industrial Automation (Automação de Processos Industriais)

Industrial Automation (Automação de Processos Industriais) Industrial Automation (Automação de Processos Industriais) PLC Programming Languages Instruction List http://users.isr.ist.utl.pt/~jag/courses/api1718/api1718.html Prof. Paulo Jorge Oliveira, original

More information

Korea University of Technology and Education

Korea University of Technology and Education MEC52 디지털공학 Binary Systems Jee-Hwan Ryu School of Mechanical Engineering Binary Numbers a 5 a 4 a 3 a 2 a a.a - a -2 a -3 base or radix = a n r n a n- r n-...a 2 r 2 a ra a - r - a -2 r -2...a -m r -m

More information

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.6 Arithmetic and Logics Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Arithmetic instructions Signed number operations Logic

More information

The functional block diagram of 8085A is shown in fig.4.1.

The functional block diagram of 8085A is shown in fig.4.1. Lecture-13 Internal Architecture of Intel 05A The functional block diagram of 05A is shown in fig.4.1. INTA INTR RST7.5 RST5.5 RST6.5 TRAP SOD SID INTERRUPT SERIAL I/O (Internal Bus) FR(S) IR() B() C()

More information

University of Technology

University of Technology University of Technology Lecturer: Dr. Sinan Majid Course Title: microprocessors 4 th year Lecture 13 Counters Overview Counters are important components in computers The increment or decrement by one

More information

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip.

EXPERIMENT NO.1. A Microcontroller is a complete computer system built on a single chip. EXPERIMENT NO.1 AIM: Study of 8051 Microcontroller TOOLS: 8051 kit THEORY: Salient Features of 8051 A Microcontroller is a complete computer system built on a single chip. It contains all components like

More information

CO Computer Architecture and Programming Languages CAPL. Lecture 9

CO Computer Architecture and Programming Languages CAPL. Lecture 9 CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 9 Dr. Kinga Lipskoch Fall 2017 A Four-bit Number Circle CAPL Fall 2017 2 / 38 Functional Parts of an ALU CAPL Fall 2017 3 / 38 Addition

More information

BASIC PLC PROGRAMMING

BASIC PLC PROGRAMMING Q. What are ladder diagrams and sequence listing? Ladder diagram: Ladder diagrams are the most commonly used diagrams for nonelectronic control circuits. They are sometimes called elementary diagrams or

More information

GENERAL REFERENCE MANUAL. From the original English Manual - (L.C. Sept 2017)

GENERAL REFERENCE MANUAL. From the original English Manual - (L.C. Sept 2017) GENERAL REFERENCE MANUAL Preface Programma 101 is a completely self-contained desktop machine capable of operating in manual mode as a high speed electronic printing calculator, in program mode as an

More information

Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

More information

EEM336 Microprocessors I. Arithmetic and Logic Instructions

EEM336 Microprocessors I. Arithmetic and Logic Instructions EEM336 Microprocessors I Arithmetic and Logic Instructions Introduction We examine the arithmetic and logic instructions. The arithmetic instructions include addition, subtraction, multiplication, division,

More information

MicroLogix 1200 Programmable Controllers

MicroLogix 1200 Programmable Controllers Document Update MicroLogix 1200 Programmable Controllers (Catalog Numbers 1762-L24AWA, -L24BWA, - L24BXB, -L40AWA, -L40BWA and -L40BXB; Series C) Purpose of This Document This Document Update revises the

More information

Arithmetic Processing

Arithmetic Processing CS/EE 5830/6830 VLSI ARCHITECTURE Chapter 1 Basic Number Representations and Arithmetic Algorithms Arithmetic Processing AP = (operands, operation, results, conditions, singularities) Operands are: Set

More information

SX Arithmetic Routines

SX Arithmetic Routines Application Note 13 November 2000 1.0 Introduction This application note presents programming techniques for performing commonly found arithmetic operations, such as multi-byte binary addition and subtraction,

More information

EXAMPLE PROGRAMS 8085

EXAMPLE PROGRAMS 8085 P! EXAMPLE PROGRAMS 8085 Statement:Multiply the 8-bit unsigned number in memory location 2200H by the 8-bit unsigned number in memory location 2201H. Store the 8 least significant bits of the result in

More information

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah NUMBER OPERATIONS Mahdi Nazm Bojnordi Assistant Professor School of Computing University of Utah CS/ECE 3810: Computer Organization Overview Homework 4 is due tonight Verify your uploaded file before the

More information

Table of Contents

Table of Contents Table of Contents Table of Contents Table of Contents The bulletin 1772-PLC-2/20 programmable controller is a rugged, solid state programmable controller that consists of the PLC-2/20 Processor (cat. no.

More information

PASSWORD (Creating a program in the PLC and touchscreen)

PASSWORD (Creating a program in the PLC and touchscreen) PASSWORD (Creating a program in the PLC and touchscreen) This sample program provides a step by step process on how to create a password to protect a screen. It involves creating a program in the touchscreen

More information

COMP 303 Computer Architecture Lecture 6

COMP 303 Computer Architecture Lecture 6 COMP 303 Computer Architecture Lecture 6 MULTIPLY (unsigned) Paper and pencil example (unsigned): Multiplicand 1000 = 8 Multiplier x 1001 = 9 1000 0000 0000 1000 Product 01001000 = 72 n bits x n bits =

More information

Microcomputers. Outline. Number Systems and Digital Logic Review

Microcomputers. Outline. Number Systems and Digital Logic Review Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded

More information

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 2

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 2 UNIT 22: PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 2 This work covers part of outcome 3 of the Edexcel standard module: Outcome 3 is the most demanding

More information

Week /8086 Microprocessor Programming I

Week /8086 Microprocessor Programming I Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any

More information

Instruction Sets: Characteristics and Functions Addressing Modes

Instruction Sets: Characteristics and Functions Addressing Modes Instruction Sets: Characteristics and Functions Addressing Modes Chapters 10 and 11, William Stallings Computer Organization and Architecture 7 th Edition What is an Instruction Set? The complete collection

More information

Practical Course File For

Practical Course File For Practical Course File For Microprocessor (IT 473) B.Tech (IT) IV-SEM Department of IT University Institute of Engineering & Technology Panjab University, Chandigarh Page 1 INTRODUCTION... 4 EXPERIMENT-1:

More information

COMPUTER ORGANIZATION AND ARCHITECTURE

COMPUTER ORGANIZATION AND ARCHITECTURE COMPUTER ORGANIZATION AND ARCHITECTURE For COMPUTER SCIENCE COMPUTER ORGANIZATION. SYLLABUS AND ARCHITECTURE Machine instructions and addressing modes, ALU and data-path, CPU control design, Memory interface,

More information

3.1 DATA MOVEMENT INSTRUCTIONS 45

3.1 DATA MOVEMENT INSTRUCTIONS 45 3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,

More information

Arithmetic Logic Unit

Arithmetic Logic Unit Arithmetic Logic Unit A.R. Hurson Department of Computer Science Missouri University of Science & Technology A.R. Hurson 1 Arithmetic Logic Unit It is a functional bo designed to perform "basic" arithmetic,

More information

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples. MICROCONTROLLERS AND APPLICATIONS 1 Module 2 Module-2 Contents: Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples. MEMORY

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

More information

1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M

1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M Increment R16 1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M 4 x (16+48) = 256 opcodes 2 PUSH/ POP R16/M16/SR/F 2 x (8+24+4+1) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M 4 x (16+48) = 256 opcodes INC

More information

9 Multiplication and Division

9 Multiplication and Division 9 Multiplication and Division Multiplication is done by doing shifts and additions. Multiplying two (unsigned) numbers of n bits each results in a product of 2n bits. Example: 0110 x 0011 (6x3) At start,

More information

TABLE 8-1. Control Signals for Binary Multiplier. Load. MUL0 Q 0 CAQ sr CAQ. Shift_dec. C out. Load LOADQ. CAQ sr CAQ. Shift_dec P P 1.

TABLE 8-1. Control Signals for Binary Multiplier. Load. MUL0 Q 0 CAQ sr CAQ. Shift_dec. C out. Load LOADQ. CAQ sr CAQ. Shift_dec P P 1. T-192 Control Signals for Binary Multiplier TABLE 8-1 Control Signals for Binary Multiplier Block Diagram Module Microoperation Control Signal Name Control Expression Register A: A 0 Initialize IDLE G

More information

S3C80E5/P80E5/C80E7/P80E7 (Preliminary Spec)

S3C80E5/P80E5/C80E7/P80E7 (Preliminary Spec) S3C80E5/P80E5/C80E7/P80E7 (Preliminary Spec) INSTRUCTION SET 6 INSTRUCTION SET OVERVIEW The instruction set is specifically designed to support large register files that are typical of most S3C8-series

More information