EM78P153 sample program

; chip is EM78P153

; P64, P65 connected to the crystal oscillator, the oscillation mode is 4MHz crystal oscillator

; watchdog off, the instruction cycle is 2 CLOCK, P63 is the reset pin

;******************* Definition of IO port *********************

PORT6 EQU 0X06

IOC60 EQU 0X06

;**************Special function register definition******************

TCC EQU 0X01

PC EQU 0X02

PSW EQU 0X03

IOCD0 EQU 0X0D

IOCE0 EQU 0X0E

IOCF0 EQU 0X0F

RF EQU 0X0F

;*************** User-defined registers*******************

COUNTER EQU 0X10

CODE1 EQU 0X11

CODE2 EQU 0X12

CODE3 EQU 0X13

CODE4 EQU 0X14

LP_CNT0 EQU 0X15

LP_CNT1 EQU 0X16

TEMP EQU 0X17

TEMPCODE EQU 0X18

REPEAT_COUNTER EQU 0X19

SEND_DATA EQU 0X1A

USER_CODE EQU 0X1B

FLAG EQU 0X1C

;*******************FLAG bit definition **********************

C EQU 0

Z EQU 2

TCIF EQU 0

LEAD EQU 0

REPEAT EQU 1

INPUT EQU 1

OUTPUT EQU 0

ORG 0X000

NOP

NOP

NOP

NOP

JMP 0X50

;********************Table conversion subroutine program ******************

TABLE_CONVER:

CLR TEMP

TABLE_CONVER_1:

MOV A, TEMP

CALL TABLE_CONVERSION_IN

BC PSW, Z

XOR A, CODE3

JBC PSW, Z

JMP EXIT_5

INC TEMP

JMP TABLE_CONVER_1

EXIT_5:

CALL TABLE_CONVERSION_OUT

RET

;**********************Table Conversion Program IN*********************

TABLE_CONVERSION_IN:

ADD PC, A

RETL 0XD0 ;KEY_1

RETL 0X58 ;KEY_2

RETL 0XD8; KEY_3

RETL 0X90; KEY_4

RETL 0X18; KEY_5

RETL 0X98; KEY_6

RETL 0XE0 ; KEY_7

RETL 0X68; KEY_8

RETL 0XE8; KEY_9

RETL 0X28 ;KEY_0

RETL 0X20; KEY_3D

RETL 0XA0 ; KEY_MUTE

RETL 0X40; KEY_VOCAL

RETL 0XE2; KEY_VOL+

RETL 0XA2 ; KEY_VOL-

RETL 0X52; KEY_TUNE FWD

RETL 0X22; KEY_TUNE REV

RETL 0X12; KEY_STOP

RETL 0X80; KEY_

RETL 0X02; KEY_OK

RETL 0XF0 ; KEY_TUNER

RETL 0X78; KEY_AM/FM

RETL 0XF8; KEY_SAVE

RETL 0X50; KEY_AUDIO

;**********************Table Conversion Program OUT*********************

TABLE_CONVERSION_OUT:

MOV A, TEMP

ADD PC, A

RETL 0X35; KEY_1

RETL 0X2D ; KEY_2

RETL 0X25; KEY_3

RETL 0X1D; KEY_4

RETL 0X34; KEY_5

RETL 0X2C; KEY_6

RETL 0X24; KEY_7

RETL 0X1C; KEY_8

RETL 0X33; KEY_9

RETL 0X2B; KEY_0

RETL 0X10; KEY_3D

RETL 0X18; KEY_MUTE

RETL 0X11; KEY_VOCAL

RETL 0X16; KEY_VOL+

RETL 0X15; KEY_VOL-

RETL 0X28; KEY_TUNE FWD

RETL 0X2A ; KEY_TUNE REV

RETL 0X22; KEY_STOP

RETL 0X31; KEY_

RETL 0X29; KEY_OK

RETL 0X2E; KEY_TUNER

RETL 0X20; KEY_AUX-1

RETL 0X23; KEY_AUX-2

RETL 0X17; KEY_DVD

ORG 0X050

MAIN:

;*********************Initial register**********************

MOV A, @0B00000000

IOW IOCE0

MOV A, @0B11111101

IOW IOCD0

MOV A, @0B00000010

IOW IOC60

MOV A, @0B00000001

MOV PORT6, A

MOV A, @0B00000001

IOW IOCF0

CLR FLAG

CLR TEMPCODE

CLR COUNTER

CLR CODE1

CLR CODE2

CLR CODE3

CLR CODE4

MOV A, @0B10010000

MOV USER_CODE, A

;********************* Scanning guide code**********************

SCAN_LEAD_CODE:

JBC PORT6, INPUT

JMP SCAN_LEAD_CODE

CLR FLAG

CLR REPEAT_COUNTER

CLR TEMPCODE

CALL JUDGE_START_CODE

JBS FLAG, LEAD

JMP SCAN_LEAD_CODE

;*********************Receive data**********************

RECEIVE_DATA_PROCEE:

CLR TEMPCODE

CALL RECEIVE_DATA

MOV A, TEMPCODE

MOV CODE1, A

MOV A, @0 ; determine if the user code is 00

BC PSW, Z

XOR A, CODE1

JBS PSW, Z

JMP SCAN_LEAD_CODE

CLR TEMPCODE

CALL RECEIVE_DATA

MOV A, TEMPCODE

MOV CODE2, A

MOV A, @0XFF; determine if the user code is FF

BC PSW, Z

XOR A, CODE2

JBS PSW, Z

JMP SCAN_LEAD_CODE

CLR TEMPCODE

CALL RECEIVE_DATA

MOV A, TEMPCODE

MOV CODE3, A

CLR TEMPCODE

CALL RECEIVE_DATA

MOV A, TEMPCODE

MOV CODE4, A

CLR FLAG

;*********************send data**********************

SEND_DATA_PROCEE:

JBS USER_CODE, 6; the second highest order inversion of the ST code

JMP COM_1 ;=0

JMP COM_2 ;=1

COM_1:

BS USER_CODE, 6

JMP VVV

COM_2:

BC USER_CODE, 6

JMP VVV

VVV:

CALL TABLE_CONVER ; call the code table conversion subroutine

MOV CODE3, A

REP:

CALL TRANSMIT_DATA

BS PORT6, OUTPUT

CALL JUDGE_REPEAT_CODE ; Is the scan boot code repeated?

JBS FLAG, LEAD

JMP SCAN_LEAD_CODE

JBC FLAG, REPEAT

JMP REP ; the boot code is a duplicate, continue scanning

JMP RECEIVE_DATA_PROCEE ; the boot code is not repeated, to receive new data

;****************Detection code detection program *****************

JUDGE_START_CODE:

CLR COUNTER; clear counter

JUDGE_START_CODE_0:

JBC PORT6, INPUT

JMP NO_HIGH

CALL DELAY0.5MS

JBC PORT6, INPUT

JMP NO_HIGH

INC COUNTER

JMP JUDGE_START_CODE_0

NO_HIGH:

MOV A, COUNTER

BC PSW, C

SUB A, @20 ;20-A

JBS PSW, C

JMP EXIT_0 ; C=1, COUNTER>20

MOV A, COUNTER

BC PSW, C

SUB A, @16 ;16-A

JBC PSW, C

JMP EXIT_0 ; C=0, COUNTER250

JBC PORT6, INPUT

JMP CONTINUE_2

MOV A, TCC

MOV TEMP, A

BC PSW, C

SUB A, @60;142

JBC PSW, C

JMP X1 ; C=1, TCC60

X1:

BC TEMPCODE, 0

JMP EXIT_1

X2:

BS TEMPCODE, 0

JMP EXIT_1

EXIT_1:

DJZ COUNTER

JMP HH

MOV A, @0B00100000

CONTW; stop counting

RET

HH:

BC PSW, C

RLC TEMPCODE

JMP CONTINUE_1

;****************Send data subroutine**********************

TRANSMIT_DATA:

MOV A, @4

MOV COUNTER, A

MOV A, USER_CODE; @0B10010000 ; Send ST user code

MOV SEND_DATA, A

CYCLE_1:

JBS SEND_DATA, 7

JMP SEND_P_0

JMP SEND_P_1

SEND_P_1:

CALL SEND_CODE_1

JMP EXIT_3

SEND_P_0:

CALL SEND_CODE_0

JMP EXIT_3

EXIT_3:

RLC SEND_DATA

DJZ COUNTER

JMP CYCLE_1

MOV A, @8

MOV COUNTER, A

MOV A, CODE3

MOV SEND_DATA, A

RLC SEND_DATA

CYCLE_2:

JBS SEND_DATA, 7

JMP SEND_Q_0

JMP SEND_Q_1

SEND_Q_1:

CALL SEND_CODE_1

JMP EXIT_4

SEND_Q_0:

CALL SEND_CODE_0

JMP EXIT_4

EXIT_4:

RLC SEND_DATA

DJZ COUNTER

JMP CYCLE_2

RET

;***************Send data "1" subroutine **********************

SEND_CODE_1:

MOV A, @0B00100000

CONTW; stop counting

MOV A, @0B00000001; allow TCC interrupt

IOW IOCF0

MOV A, @35 ; preset value of the pilot pulse

MOV TCC, A

MOV A, @0B00000001 ; select the prescaler ratio to 1:4

CONTW

BC PORT6, OUTPUT

WAIT_1:

JBS RF, TCIF

JMP WAIT_1

MOV A, @0B00100000

CONTW; stop counting

BC RF, TCIF

MOV A, @32; preset value for code "1"

MOV TCC, A

MOV A, @0B00000101 ; select the prescaler ratio to 1:64

CONTW

BS PORT6, OUTPUT

WAIT_2:

JBS RF, TCIF

JMP WAIT_2

BC RF, TCIF

MOV A, @0B00100000

CONTW; stop counting

RET

;***************Send data "0" subroutine **********************

SEND_CODE_0:

MOV A, @0B00100000

CONTW; stop counting

MOV A, @0B00000001; allow TCC interrupt

IOW IOCF0

MOV A, @35 ; preset value of the pilot pulse

MOV TCC, A

MOV A, @0B00000001 ; select the prescaler ratio to 1:4

CONTW

BC PORT6, OUTPUT

WAIT_3:

JBS RF, TCIF

JMP WAIT_3

MOV A, @0B00100000

CONTW; stop counting

BC RF, TCIF

MOV A, @114; preset value for code "0"

MOV TCC, A

MOV A, @0B00000101 ; select the prescaler ratio to 1:64

CONTW

BS PORT6, OUTPUT

WAIT_4:

JBS RF, TCIF

JMP WAIT_4

NOP

BC RF, TCIF

MOV A, @0B00100000

CONTW; stop counting

RET

;**************** Repeat code detection subroutine ******************

JUDGE_REPEAT_CODE:

CLR COUNTER; clear counter

CLR FLAG

JUDGE_REPEAT_CODE_0:

JBC PORT6, INPUT

JMP JUDGE_REPEAT_CODE_0

SS:

JBC PORT6, INPUT

JMP JUDGE_REPEAT_CODE_1

CALL DELAY0.5MS

JBC PORT6, INPUT

JMP JUDGE_REPEAT_CODE_1

INC COUNTER

JMP SS

JUDGE_REPEAT_CODE_1:

MOV A, COUNTER

BC PSW, C

SUB A, @20 ;20-A

JBS PSW, C

JMP EXIT_2 ; C=1, COUNTER>20

MOV A, COUNTER

BC PSW, C

SUB A, @16 ;16-A

JBC PSW, C

JMP EXIT_2 ; C=0, COUNTER7

JMP YES_REPEAT ; C=1, COUNTER

Printer Accessories

These printer accessories are include of printer grid, Eliminator,etc.

The cartridge is irradiated by laser beam to adsorb toner, and then the toner is hot pressed by fixing roller for printing. In this process, there will be part of toner residual, which can not be "granules returned to the warehouse"; Automatic cleaning function is not adsorbed new toner particles and directly print, will remain toner away, fully ensure the next printing effect. And the Plate-Grid plays an important role. When high voltage generator to a high voltage electrode, wire electrode with reseau formed between a strong electric field, and release the corona, wire electrode and the photosensitive drum ionizes the air between the air ions migrate to the drum surface, make the photoconductor (drum) surface is full of charge, so can spare toner "adsorption to warehouse", so as to save toner, The purpose of reducing environmental pollution.

Hp Printer Tray,Hp Printer Paper Tray,Usb A Printer Cable,Printer With Paper Tray

SHAOXING HUALI ELECTRONICS CO., LTD. , https://www.cnsxhuali.com

Posted on