beautypg.com

Applications – Rainbow Electronics ADC0838 User Manual

Page 17

background image

Applications

(Continued)

Digital Link and Sample Controlling Software for the

Serially Oriented COP420 and the Bit Programmable I O INS8048

TL H 5583 – 13

COP CODING EXAMPLE

Mnemonic

Instruction

LEI

ENABLES SIO’s INPUT AND OUTPUT

SC

C e 1

OGI

G0e0 (CSe0)

CLR A

CLEARS ACCUMULATOR

AISC 1

LOADS ACCUMULATOR WITH 1

XAS

EXCHANGES SIO WITH ACCUMULATOR
AND STARTS SK CLOCK

LDD

LOADS MUX ADDRESS FROM RAM
INTO ACCUMULATOR

NOP
XAS

LOADS MUX ADDRESS FROM
ACCUMULATOR TO SIO REGISTER

u

8 INSTRUCTIONS

v

XAS

READS HIGH ORDER NIBBLE (4 BITS)
INTO ACCUMULATOR

XIS

PUTS HIGH ORDER NIBBLE INTO RAM

CLR A

CLEARS ACCUMULATOR

RC

C e 0

XAS

READS LOW ORDER NIBBLE INTO
ACCUMULATOR AND STOPS SK

XIS

PUTS LOW ORDER NIBBLE INTO RAM

OGI

G0e1 (CSe1)

LEI

DISABLES SIO’s INPUT AND OUTPUT

8048 CODING EXAMPLE

Mnemonic

Instruction

START

ANL

P1

0F7H

SELECT A D (CSe0)

MOV

B

5

BIT COUNTER

w

5

MOV

A

ADDR

A

w

MUX ADDRESS

LOOP 1

RRC

A

CY

w

ADDRESS BIT

JC

ONE

TEST BIT
BITe0

ZERO

ANL

P1

0FEH

DI

w

0

JMP

CONT

CONTINUE
BITe1

ONE

ORL

P1

1

DI

w

1

CONT

CALL PULSE

PULSE SK 0

x

1

x

0

DJNZ B LOOP 1

CONTINUE UNTIL DONE

CALL PULSE

EXTRA CLOCK FOR SYNC

MOV

B

8

BIT COUNTER

w

8

LOOP 2

CALL PULSE

PULSE SK 0

x

1

x

0

IN

A P1

CY

w

DO

RRC

A

RRC

A

MOV

A C

A

w

RESULT

RLC

A

A(0)

w

BIT AND SHIFT

MOV

C A

C

w

RESULT

DJNZ B LOOP 2

CONTINUE UNTIL DONE

RETR

PULSE SUBROUTINE

PULSE

ORL

P1

04

SK

w

1

NOP

DELAY

ANL

P1

0FBH

SK

w

0

RET

17