Intel mcs-48 manual Strt CNT Start Event Counter, Strt T Start Timer

Models: mcs-48

1 478
Download 478 pages 26.88 Kb
Page 107
Image 107

INSTRUCTION SET

STRT CNT Start Event Counter

10100101011

The test 1 (T1) pin is enabled as the event-counter input and the counter is started. The event-counter register is incremented with each high-to-Iow transition on the T1 pin.

Example: Initialize and start event counter. Assume overflow is desired with first T1 input.

STARTC: EN TCNTI ;ENABLE COUNTER INTERRUPT MOV A,#OFFH ;MOVE 'FF'HEX (ONES) TO

;ACC

MOV T,A ;MOVE ONES TO COUNTER

STRT CNT ;ENABLE T1 AS COUNTER ;INPUT AND START

STRT T Start Timer

10101101011

Timer accumulation is initiated in the timer register. The register is incremented every 32 instruction cycles. The prescaler which counts the 32 cycles is cleared but the timer register is not.

Example: Initialize and start timer.

 

STARTT: CLR A

;CLEAR ACC TO ZEROS

MOV T,A

;MOVE ZEROS TO TIMER

EN TCNTI

;ENABLE TIMER INTERRUPT

STRT T

;START TIMER

SWAP A Swap Nibbles Within Accumulator

10 100101111

Bits 0-3 of the accumulator are swapped with bits 4-7 of the accumulator.

(A4- 7) ~ (Ao-3)

Example: Pack bits 0-3 of locations 50-51 into location 50. PCKDIG: MOV RO, #50 ;MOVE '50'DEC TO REG 0

MOV R1, #51 ;MOVE '51'DEC TO REG 1 XCHD A,@RO ;EXCHANGE BITS 0-3 OF ACC

;AND LOCATION 50

SWAP A ;SWAP BITS 0-3 AND 4-7 OF ACC XCHD A,@R1 ;EXCHANGE BITS 0-3 OF ACC AND

;LOCATION 51

MOV @RO,A ;MOVE CONTENTS OF ACC TO ;LOCATION 50

Mnemonics copyright Intel Corporation 1976.

4-34

Page 107
Image 107
Intel mcs-48 manual Strt CNT Start Event Counter, Strt T Start Timer, Swap a Swap Nibbles Within Accumulator