6498 views|3 replies

1379

Posts

0

Resources
The OP
 

MCU Assembly Program Design MCU Audio Control Program [Copy link]

VARIABLES DECLARATION ;
;********************************************************************;
;SYS_OPTION EQU 2FH
CONST_1 EQU 05H
; bit[7]=0 the program use for M62429
; =1 the program use for PT2322
;---------------------------------------
; Variable for IR Receiver ---->>>>
IR_COUNTER EQU 00H
IR_DATA2 EQU 01H ; IR_DATA2 is received befor IR_DATA1
IR_DATA1 EQU 02H
BIT_FLAG EQU 20H
SIGN_F BIT BIT_FLAG.0
CONTINUE_F BIT BIT_FLAG.1
IRDATA_SPEED EQU 03H ; Adjust the speed of ir receiver
IRDATA_HOLD EQU 04H ; if timer-out, then clr IR data
;---------------------------------------
; Variable for LED display ----->>>>
COUNTER_1 EQU 06H
COUNTER_2 EQU 07H
DISPLAY_COMA EQU 47H
DISPLAY_COMB EQU 48H
;DISPLAY_COMC EQU 49H
DISPLAY_COM0 EQU 08H ; one
DISPLAY_COM1 EQU 09H ; ten
DISPLAY_COM2 EQU 0AH ; LED display

; bit[7]=XXXX bit[6]=Subwoof bit[5]=Surround bit[4]=Center
; bit[3]=Front bit[2]=Volume bit[1]=Mute bit[0]=ON/St-by
;PORT_EXT EQU 0BH ; for 74ALS373
; bit[7]=power bit[6]=Mute bit[5]=By pass bit[4:3]=DVD/CD/TAPE
; bit[5:3]=111 DVD (Bypass on)
; =010 CD (bypass off)
; =001 TYPE (bypass off)
; if bit[2]=1 :send data to IC1 (FL & FR)
; if bit[1]=1 :send data to IC2 (CEN & SUB)
; if bit[0]=1 :send data to IC3 (SL & SR)
COM0_FLAG BIT BIT_FLAG.2
COM1_FLAG BIT BIT_FLAG.3
;---------------------------------------
; Variable for transmitte data to M62429P ---->>>>
; M62429 data format: (xx xxxxxxx xx :total 11 bits)
; bit[1:0]=11,
; bit[8:2]=Volume,
; bit[9]=0:send to both channel at a time =1:send a channel data at a time
; bit[10]=0:send data to 1st channel =1:send data to 2nd channel
; the data bit[10] will send out first
VOL_MAS EQU 2CH
VOL_FL EQU 4AH
VOL_FR EQU 4BH
VOL_CEN EQU 4CH
VOL_SUB EQU 4DH
VOL_SL EQU 4EH
VOL_SR EQU 4FH
DVD_CD_F BIT BIT_FLAG.5 ; =0 DVD
MUTE_ENABLE BIT BIT_FLAG.6 ; =1 MUTE
MODE_FLAG EQU 32H
; bit[4]= the key flag for "SUB"
; bit[3]= the key flag for "CEN"
; bit[2]= the key flag for "SURRL"
; bit[1]= the key flag for "FRONT"
; bit[0]= the key flag for "VOL"
;---------------------------------------
; Variable for transmitte data to pt2322 & PT2323 ---->>>>
SEND__D1 EQU 30H
SEND__D2 EQU 31H
SEND_FLAG EQU 21H ; share with M62429
;for PT2322:
; bit[7:4] Roll flag for byte send
; bit[3:0] Counter the times of DATA_SEND
;for M62429:
; bit[0]= bit[9] of m62429p
; bit[1]= No used
; bit[2]= bit[10] of m62429
; bit[4:3]= No used
; bit[7:5] Roll flag for send data to m62429
REPLACE_VAR EQU 22H ; share with M62429
; the value will ( >=40 & <=123 ) for M62429 data send
ADDR_FLAG BIT BIT_FLAG.4 ; 0:Send to PT2322 1:Send to PT2323
;===============================================================
; --------------Var for PT2322-----------
; PT2322 Chip Address: 88H
; PT2322 COMMAND: 0xH,8xH:No function
; 1xH:Front_L 2xH:Front_R 3xH:Center 4xH:Rear_L 5xH:Rear_R
; 6xH:Subwoof 7xH:Fun_Sel 9xH:Bass AxH:Middle BxH:Treble
; CxH:Input_SW DxH:VOL_L ExH:VOL_H FxH:sys_reset
;VOLUME EQU 40H
; Main volume (-79dB to 0dB step 1dB)
;FRONT_REAR EQU 41H
; Front & Rear volume (-15dB to 0dB step 1dB)
;CENTER_SUB EQU 42H
; Center & Subwoof volume (-15dB to 0dB step 1dB)
;TREBLE_BAS EQU 43H
; Treble & Bass adjust (-14dB to +14dB step 2dB)
;FUNSEL_MID EQU 44H
; Function select(Mute,3D,Tone,X),Middle tone adjust (-14dB to +14dB step 2dB)
; --------------Var for PT2323-------------
; PT2323 Chip Address: 94H
; PT2323 COMMAND:
; CxH:Input Switch FxH:Mute for any channel
; D0H/D1H:Surround en/dis 90H:Mixed Channel ON
;INPUT_SW EQU 45H
; bit[3:0]=0111 6-Ch Input
; 1000 Input Stereo Group 4
; 1001 Input Stereo Group 3
; 1010 Input Stereo Group 2
; 1011 Input Stereo Group 1
;MUTE_2323 EQU 46H
; bit[3:0]=0000 FL Mute DIS =0001 FL Mute EN
; =0010 FR Mute DIS =0011 FR Mute EN
; =0100 CT Mute DIS =0101 CT Mute EN
; =0110 SUB Mute DIS =0111 SUB Mute EN
; =1000 SL Mute DIS =1001 SL Mute EN
; =1010 SR Mute DIS =1011 SR Mute EN
; =1110 All Mute DIS =1111 All Mute EN
;===============================================================
;----------------------------------------
KEY_FLAG EQU 23H
; bit[7]= a key action need to process
; bit[6]= a key action is processing
; bit[5]= the key flag for "POWER" key
; bit[4]= the key flag for "MUTE" key
; bit[3]= the key flag for "MODE" key
; bit[2]= the key flag for "CHANNEL" key
; bit[1]= the key flag for "UP" key
; bit[0]= the key flag for "DOWN" key
KEY_POWER EQU 24H
KEY_MUTE EQU 25H
KEY_CHANNEL EQU 26H
KEY_MODE EQU 27H
KEY_UP EQU 28H
KEY_DOWN EQU 29H
MODE_1 EQU 51H
DELAY_A EQU 2DH
DELAY_B EQU 2EH
DELAY_H EQU 2BH
DELAY_L EQU 2AH
;---------------------------------------------------------------------
;
;********************************************************************;
; ;
; PROGRAM STARTS ;
;********************************************************************;
ORG 0000H ; INITIAL RESET
JMP START

ORG 0003H ; INT0
PUSH ACC
PUSH PSW
JMP IR_RECEIVE

ORG 000BH ; TIMER0
PUSH ACC
PUSH PSW
JMP IR_RECEIVE2

ORG 0013H ; INT1
PUSH ACC
PUSH PSW
JMP SCAN_KEY

ORG 001BH ; TIMER1
PUSH ACC
PUSH PSW
JMP LED_DISPLAY

ORG 0023H ; S_PORT
PUSH ACC
PUSH PSW
JMP INT_RETURN

INT_RETURN:
POP PSW
POP ACC
RETI
;
;*********************************************************************
;

;********************************************************************;
; PROGRAM STARTS ;
;********************************************************************;
ORG 030H
START:

MOV KEY_FLAG,#00
MOV KEY_POWER,#00
MOV KEY_MUTE,#00
MOV KEY_CHANNEL,#00
MOV KEY_MODE,#00
MOV KEY_UP,#00
MOV KEY_DOWN,#00

; MOV SYS_OPTION,#00
MOV IR_COUNTER,#00
MOV IR_DATA1,#0FFH
MOV IR_DATA2,#0FFH
MOV IRDATA_SPEED,#00
MOV BIT_FLAG,#00
MOV DISPLAY_COM0,#00
MOV DISPLAY_COM1,#00
MOV DISPLAY_COM2,#0FBH

; MOV DISPLAY_COMC,#00

; MOV PORT_EXT,#0B8H
SETB DVD_CD_F
CLR MUTE_ENABLE
MOV MODE_FLAG,#00

START2:
; A, B, PSW, SP, DPTR, P0, P1, P2, P3, IP, IE, TMOD, TCON,
; TH0, TL0, TH1, TL1, SCON, SBUF, PCON
; MOV SCON,#00H ; SM0,SM1,SM2,REN, TB8,RB8,TI,RI
; MOV PCON,#00H ; SMOD,X,X,X, X,X,Idle,PD
; ANL PSW,#0E7H ; CY,AC,F0,RS1, RS0,OV,X,P
; MOV TH0,#00H
; MOV TL0,#00H
; MOV TMOD,#11H ; GATE,C/T,M1,M0(Tm1), GATE,C/T,M1,M0(Tm0)
; MOV TCON,#10H ; TF1,TR1,TF0,TR0, IE1,IT1,IE0,IT0
; MOV IE,#84H ; EA,X,X,ES, ET1,EX1,ET0,EX0
; MOV IP,#00H ; X,X,X,PS, PT1,PX1,PT0,PX0

MOV SP,#6AH
MOV PSW,#00
MOV IP,#1FH
MOV TMOD,#11H
MOV TH1,#0EDH
MOV TL1,#078H
MOV TCON,#45H ; enable timer1 counter
MOV IE,#0BH ; enable TM0 & TM1 & INT0 interrupt

MOV P3,#0BCH ; 1011 1100
MOV P1,#0FFH

MOV KEY_FLAG,#40H
CALL DELAY_300MM
MOV SEND__D1,#0C0H
MOV SEND__D2,#0C0H
CALL SEND_CV2653

MOV VOL_SL,#39
MOV VOL_SR,#39
MOV VOL_FL,#39
MOV VOL_FR,#39
MOV VOL_CEN,#39
MOV VOL_SUB,#39
MOV VOL_MAS,#39
JMP DPR2653_VOLUME_HI
MAIN_END:
nop
nop
nop
; MOV SEND__D1,COUNTER_1
; CALL SEND_CV2653
; ORL PCON,#02H
JB KEY_FLAG.7,KEY_PROCESS
SJMP MAIN_END


;================================================
;INIT2322_TAB:
; DB 94,94,94,88,88,88,88,88,88,88,88,88,88,88,88,88
; DB 0FEH,0C8H,0D0H,0C7H,074H,037H,067H,017H
; DB 027H,047H,057H,0E4H,0D8H,0BFH,0AFH,09FH
This post is from MCU
 

1379

Posts

0

Resources
2
 
Scan keypad part ; ;********************************************************************** KEY_PROCESS: CLR IE.7 CLR KEY_FLAG.7 SETB KEY_FLAG.6 JB KEY_FLAG.5,KEY_PROCESS_POWER JB KEY_FLAG.4,KEY_PROCESS_MUTE JB KEY_FLAG.3,KEY_PROCESS_MODE JB KEY_FLAG.2,KEY_PROCESS_CHANNEL1 JB KEY_FLAG.1,KEY_PROCESS_UP1 JB KEY_FLAG.0,KEY_PROCESS_DOWN1 JMP KEY_PROCESS_END KEY_PROCESS_UP1: JMP KEY_PROCESS_UP KEY_PROCESS_CHANNEL1: JMP KEY_PROCESS_CHANNEL KEY_PROCESS_DOWN1: JMP KEY_PROCESS_DOWN KEY_PROCESS_POWER: ; JMP DPR2653_FRONT_H JMP KEY_PROCESS_END KEY_PROCESS_MUTE: JMP DPR2653_MUTE KEY_PROCESS_ENDA: JMP KEY_PROCESS_END KEY_PROCESS_MODE: JB BIT_FLAG.6, KEY_PROCESS_ENDA ;MUTE INC MODE_FLAG MOV ACC,MODE_FLAG CLR C ANL A,#07H JZ KEY_PROCESS_MODE_VOL SUBB A,#01 JZ KEY_PROCESS_MODE_FRONT SUBB A,#01 JZ KEY_PROCESS_MODE_CEN SUBB A,#01 JZ KEY_PROCESS_MODE_SURR SUBB A,#01 JZ KEY_PROCESS_MODE_SW MOV MODE_FLAG,#00 KEY_PROCESS_MODE_VOL: ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FDH ; lit on Valume_LED MOV A,VOL_MAS DEC A MOV VOL_MAS,A JMP DPR2653_VOLUME_H3 JMP KEY_PROCESS_END KEY_PROCESS_MODE_FRONT: ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FBH ; lit on Front_LED MOV A,VOL_FL DEC A MOV VOL_FL,A JMP DPR2653_FRONT_H1 JMP KEY_PROCESS_END KEY_PROCESS_MODE_CEN: ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0F7H ; lit on Center_LED MOV A,VOL_CEN DEC A MOV VOL_CEN,A JMP DPR2653_CENTER_H1 JMP KEY_PROCESS_END KEY_PROCESS_MODE_SURR: ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0EFH ; lit on Rear_LED MOV A,VOL_SL DEC A MOV VOL_SL,A JMP DPR2653_REAR_H1 JMP KEY_PROCESS_END KEY_PROCESS_MODE_SW: ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0DFH ; lit on SUBWF_LED MOV A,VOL_SUB DEC A MOV VOL_SUB,A JMP DPR2653_SUBWF_H1 JMP KEY_PROCESS_END KEY_PROCESS_CHANNEL: JMP DPR2653_DVD_CD KEY_PROCESS_UP: MOV DPTR,#KEY_PROUP_TAB MOV ACC,MODE_FLAG ANL A,#07H RL A JMP @A+DPTR KEY_PROUP_TAB: AJMP DPR2653_VOLUME_H AJMP DPR2653_FRONT_H AJMP DPR2653_CENTER_H AJMP DPR2653_REAR_H AJMP DPR2653_SUBWF_H AJMP KEY_PROCESS_END AJMP KEY_PROCESS_END AJMP KEY_PROCESS_END KEY_PROCESS_DOWN: MOV DPTR,#KEY_PRODOWN_TAB MOV ACC,MODE_FLAG ANL A,#07H RL A JMP @A+DPTR KEY_PRODOWN_TAB: AJMP DPR2653_VOLUME_L AJMP DPR2653_FRONT_L AJMP DPR2653_CENTER_L AJMP DPR2653_REAR_L AJMP DPR2653_SUBWF_L AJMP KEY_PROCESS_END AJMP KEY_PROCESS_END AJMP KEY_PROCESS_END KEY_PROCESS_END: ; CLR KEY_FLAG.6 MOV KEY_FLAG,#00 SETB IE.7 JMP MAIN_END ;====================================================================== SCAN_KEY: SCAN_RETURN: POP PSW POP ACC RETI ; LED Display and Common Counter part ; ;********************************************************************** LED_DISPLAY: MOV TH1,#0EDH ; CYC = 66.7Hz (5msinterrupt) MOV TL1,#078H ORL TCON,#40H JNB DELAY_H.7,LED_DISPLAY2 MOV ACC,DELAY_L JNZ DOWN_COUNT2 MOV ACC,DELAY_H ANL ACC,#0FH JNZ DOWN_COUNT1 CALL DPR2653_VOLUME_H4 DOWN_COUNT1: DEC DELAY_H DOWN_COUNT2: DEC DELAY_L ;---------------------------- LED_DISPLAY2: MOV C,COM0_FLAG JNC DISP_ONE MOV C,COM1_FLAG JC DISP_LED JMP DISP_TEN ;----------------------------------------------- DISP_LED: SCANKEY_UP: JB P3.3,SCANKEY_UPA INC KEY_UP JB KEY_UP.5,SCANKEY_UP0 JB KEY_UP.6,SCANKEY_CHANNEL JB KEY_UP.3,SCANKEY_UP3 JB KEY_UP.7,SCANKEY_CHANNEL JB KEY_UP.2,SCANKEY_UP2 SJMP SCANKEY_CHANNEL SCANKEY_UP0: ANL KEY_UP,#80H SJMP SCANKEY_UP3 SCANKEY_UP2: SETB KEY_UP.6 SETB KEY_UP.7 SCANKEY_UP3: ANL KEY_UP,#0F0H SETB KEY_FLAG.1 SETB KEY_FLAG.7 SJMP SCANKEY_CHANNEL SCANKEY_UPA: MOV KEY_UP,#00 SCANKEY_CHANNEL: JB P3.4,SCANKEY_CHANNELA JB KEY_CHANNEL.7,DISP_LED_2 INC KEY_CHANNEL JNB KEY_CHANNEL.2,DISP_LED_2 ANL KEY_CHANNEL,#0F0H SETB KEY_CHANNEL.7 SETB KEY_FLAG.2 SETB KEY_FLAG.7 SJMP DISP_LED_2 SCANKEY_CHANNELA: MOV KEY_CHANNEL,#00 ;; DISP_LED_2: ORL P3,#0A0H ORL P1,#080H ; Clear off all the display CLR COM0_FLAG ORL DISPLAY_COM2,#80H MOV P1,DISPLAY_COM2 ANL P1,#7FH AJMP DISPLAY_RTN ;----------------------------------------------- DISP_ONE: SCANKEY_DOWN: JB P3.3,SCANKEY_DOWNA INC KEY_DOWN JB KEY_DOWN.5,SCANKEY_DOWN1 JB KEY_DOWN.6,SCANKEY_MODE JB KEY_DOWN.3,SCANKEY_DOWN3 JB KEY_DOWN.7,SCANKEY_MODE JB KEY_DOWN.2,SCANKEY_DOWN2 SJMP SCANKEY_MODE SCANKEY_DOWN1: ANL KEY_DOWN,#80H SJMP SCANKEY_DOWN3 SCANKEY_DOWN2: SETB KEY_DOWN.6 SETB KEY_DOWN.7 SCANKEY_DOWN3: ANL KEY_DOWN,#0F0H SETB KEY_FLAG.0 SETB KEY_FLAG.7 SJMP SCANKEY_MODE SCANKEY_DOWNA: MOV KEY_DOWN,#00 SCANKEY_MODE: JB P3.4,SCANKEY_MODEA JB KEY_MODE.7,DISP_ONE_2 INC KEY_MODE JNB KEY_MODE.2,DISP_ONE_2 ANL KEY_MODE,#0F0H SETB KEY_MODE.7 SETB KEY_FLAG.3 SETB KEY_FLAG.7 SJMP DISP_ONE_2 SCANKEY_MODEA: MOV KEY_MODE,#00 DISP_ONE_2: ORL P3,#0A0H ORL P1,#080H ; Clear off all the display SETB COM0_FLAG CLR COM1_FLAG MOV DPTR,#LED_TABLE MOV ACC,DISPLAY_COM0 MOVC A,@A+DPTR ORL A,#80H MOV P1,ACC ANL P3,#0DFH AJMP DISPLAY_RTN ;------------------------------------------------ DISP_TEN: SCANKEY_POWER: JB P3.3,SCANKEY_POWERA JB KEY_POWER.7,SCANKEY_MUTE INC KEY_POWER JNB KEY_POWER.2,SCANKEY_MUTE ANL KEY_POWER,#0F0H SETB KEY_POWER.7 SETB KEY_FLAG.5 SETB KEY_FLAG.7 SJMP SCANKEY_MUTE SCANKEY_POWERA: MOV KEY_POWER,#00 SCANKEY_MUTE: JB P3.4,SCANKEY_MUTEA JB KEY_MUTE.7,DISP_TEN_2 INC KEY_MUTE JNB KEY_MUTE.2,DISP_TEN_2 ANL KEY_MUTE,#0F0H SETB KEY_MUTE.7 SETB KEY_FLAG.4 SETB KEY_FLAG.7 SJMP DISP_TEN_2 SCANKEY_MUTEA: MOV KEY_MUTE,#00 ;; DISP_TEN_2: ORL P3,#0A0H ORL P1,#080H ; Clear off all the display SETB COM1_FLAG MOV DPTR,#LED_TABLE MOV ACC,DISPLAY_COM1 MOVC A,@A+DPTR ORL A,#80H MOV P1,ACC ANL P3,#7FH DISPLAY_RTN: CALL COUNTER POP PSW POP ACC RETI ;---------------------------------------------------------------------- LED_TABLE: DB 10001000B,11011011B,10100010B,10010010B DB 11010001B,10010100B,10000100B,11011010B DB 10000000B,10010000B,11110111B ;====================================================================== COUNTER: INC IRDATA_HOLD MOV ACC,IRDATA_HOLD JNB ACC.7,COUNTER2 ; if no data received within 0.32s MOV IRDATA_HOLD,#00 MOV ACC,IR_COUNTER JNZ COUNTER2 MOV IR_DATA2,#0FFH ; then clear the received IR data COUNTER2: INC COUNTER_1 MOV ACC,COUNTER_1 JNZ COUNTER_RTN INC COUNTER_2 COUNTER_RTN: RET
This post is from MCU
 
 

1379

Posts

0

Resources
3
 
Data Receiver part ; ;********************************************************************** IR_RECEIVE: ; interrupt from port_int1(int1) ANL PSW,#0E7H CALL DELAY_50US MOV C,P3.2 JNC IR_RECEIVE01 JMP PINT_RTN IR_RECEIVE01: MOV ACC,IR_COUNTER JNB ACC.6,FIRST_BIT JB ACC.5,FIRST_DATABIT CLR CONTINUE_F ;>>>>>>>>>>>>>>>>>>>> INC IR_COUNTER MOV ACC,IR_COUNTER JB ACC.5,RECEIVE_END ANL ACC,#3FH XRL ACC,#10H JZ USERCODE_CHK DATA_RECEIVE: ACALL DATABIT_REC SJMP SET_TIMER1_A USERCODE_CHK: ACALL DATABIT_REC MOV ACC,IR_DATA2 XRL ACC,#008H ; user code 1 JNZ RECEIVE_ABORT MOV ACC,IR_DATA1 XRL ACC,#0F7H ; user code 2 JNZ RECEIVE_ABORT ACALL DATA_CLR SJMP SET_TIMER1_A RECEIVE_END: ACALL DATABIT_REC MOV ACC,IR_DATA2 XRL ACC,#0FFH XRL A,IR_DATA1 JNZ RECEIVE_ABORT ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV IR_COUNTER,#00 MOV IRDATA_HOLD,#00 SETB CONTINUE_F ;>>>>>>>>>>>>>>>>>>>>>>>> JMP DATA_PROCESS2 ; ---->> ;--------------------------------- FIRST_BIT: ; CLR CONTINUE_F MOV IR_COUNTER,#00 SJMP SET_TIMER1_A FIRST_DATABIT: ; SETB CONTINUE_F ;>>>>>>>>>>>>>>>>>>>>>>>> ANL IR_COUNTER,#0C0H SJMP SET_TIMER1_A ;--------------------------------- RECEIVE_ABORT: ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV IR_COUNTER,#00 ; ANL IE,#0FDH ; disable timer0 int MOV C,CONTINUE_F JC PINT_RTN ACALL DATA_CLR SJMP PINT_RTN ;--------------------------------- SET_TIMER1_A: ANL IR_COUNTER,#7FH CLR SIGN_F ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV TH0,#0F8H ; F7H MOV TL0,#040H ; 40H ORL TCON,#10H ; enable timer0 count ; ORL IE,#02H ; enable timer0 int PINT_RTN: POP PSW POP ACC RETI ;-------------------------------- DATABIT_REC: MOV C,SIGN_F MOV ACC,IR_DATA1 RLC A MOV IR_DATA1,ACC MOV ACC,IR_DATA2 RLC A MOV IR_DATA2,ACC RET DATA_CLR: MOV IR_DATA1,#0FFH MOV IR_DATA2,#0FFH RET ; ;====================================================================== IR_RECEIVE2: ; interrupt from timer1_int ; MOV P1,#00H MOV ACC,IR_COUNTER JB ACC.7,CONTINUE_CHK JNB ACC.6,FIRSTBIT_CHECK ORL IR_COUNTER,#80H SETB SIGN_F SJMP SET_TIMER1_1 CONTINUE_CHK: MOV C,CONTINUE_F JNC RECEIVE_ABORT MOV A,IR_DATA2 JB ACC.2,RECEIVE_ABORT JB ACC.0,RECEIVE_ABORT ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV IR_COUNTER,#00 MOV IRDATA_HOLD,#00 JMP DATA_PROCESS ; ---->> FIRSTBIT_CHECK: INC IR_COUNTER FIRST_CHK: CJNE R0,#01,SECOND_CHK MOV C,P3.2 JC RECEIVE_ABORT SJMP SET_TIMER1_1 SECOND_CHK: CJNE R0,#02,THIRD_CHK MOV C,P3.2 JC RECEIVE_ABORT SJMP SET_TIMER1_1 THIRD_CHK: CJNE R0,#03,FOURTH_CHK SJMP SET_TIMER1_1 FOURTH_CHK: MOV C,P3.2 JNC RECEIVE_ABORT MOV IR_COUNTER,#60H CLR SIGN_F ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV TH0,#0EEH MOV TL0,#80H SJMP SET_TIMER1_2 ;------------------------------ SET_TIMER1_1: ANL TCON,#0CFH ; stop timer0 count and clr EVF MOV TH0,#0F4H ; F7H MOV TL0,#040H ; 40H SET_TIMER1_2: ORL TCON,#10H ; enable timer0 count ; ANL TCON,#7FH ; clear timer0 EVF ; ORL IE,#02H ; enable timer0 int TIMER1_RTN: POP PSW POP ACC RETI DELAY_50US: MOV CONST_1,#016 LOOP_50US: NOP DJNZ CONST_1,LOOP_50US RET ;********************************************************************** ; Data process part ; ;********************************************************************** DATA_PROCESS: INC IRDATA_SPEED MOV ACC,IRDATA_SPEED JB ACC.2,DATA_PROCESS1 JMP PINT_RTN DATA_PROCESS1: ANL IRDATA_SPEED,#0F0H ORL IRDATA_SPEED,#03H JMP DATA_PROCESS3 ;---------------------------------- DATA_PROCESS2: ANL IRDATA_SPEED,#0F0H DATA_PROCESS3: ; JNB SYS_OPTION.7,DPR_CV2653 ; JMP DPR_PT2322 ;=============================================================== DPR_CV2653: MOV ACC,IR_DATA2 JB ACC.3,DPR_CV2653_2 JB ACC.1,DPR_CV2653_1 MOV DPTR,#DPR2653_TAB0 SJMP DPR_CV2653_A DPR_CV2653_1: MOV DPTR,#DPR2653_TAB1 SJMP DPR_CV2653_A DPR_CV2653_2: JB ACC.1,DPR_CV2653_3 MOV DPTR,#DPR2653_TAB2 SJMP DPR_CV2653_A DPR_CV2653_3: MOV DPTR,#DPR2653_TAB3 SJMP DPR_CV2653_A DPR_CV2653_A: SWAP A ANL A,#0FH RL A JMP @A+DPTR ;--------------------------------------------------------------- DPR2653_TAB0: ; IR_DATT2=xxxx 0000 AJMP DPR2653_FRONT_H AJMP DPR2653_REAR_H ;********* AJMP DPR2653_CENTER_H AJMP DPR2653_SUBWF_H ;******* AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_;RECOMMEND ; AJMP DPR2653_ ;REAR_H AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_FRONT_L AJMP DPR2653_REAR_L AJMP DPR2653_CENTER_L AJMP DPR2653_SUBWF_L;****** DPR2653_TAB1: ; IR_DATT2=xxxx 0010 AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_MUTE ;************* AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_VOLUME_H2 AJMP DPR2653_ AJMP DPR2653_ ; 08 AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_VOLUME_L ; AJMP DPR2653_ DPR2653_TAB2: ; IR_DATT2=xxxx 1000 AJMP DPR2653_DVD AJMP DPR2653_DVD AJMP DPR2653_ AJMP DPR2653_ AJMP DPR2653_VOLUME_H AJMP DPR2653_ AJMP DPR2653_VOLUME_L AJMP DPR2653_ AJMP DPR2653_ ; 08 AJMP DPR2653_CD AJMP DPR2653_VOLUME_H2 AJMP DPR2653_ AJMP DPR2653_CD AJMP DPR2653_CD AJMP DPR2653_VOLUME_L2 ; AJMP DPR2653_ DPR2653_TAB3: ; IR_DATT2=xxxx 1010 ; AJMP DPR2653_DVD ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; 08 ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ; AJMP DPR2653_ ;-------------------------- DPR2653_: JMP PINT_RTN ;-------------------------- DPR2653_MUTE: CALL DATA_CLR MOV C,MUTE_ENABLE JC MUTE_DIS MUTE_EN: MOV DISPLAY_COMA,#00 MOV DISPLAY_COMB,#00 MOV DISPLAY_COMA,DISPLAY_COM0 MOV DISPLAY_COMB,DISPLAY_COM1 ; MOV DISPLAY_COMC,DISPLAY_COM2 MOV DISPLAY_COM0,#00AH MOV DISPLAY_COM1,#00AH ; MOV DISPLAY_COM2,#0FFH SETB MUTE_ENABLE ; set Mute_pin to H MOV SEND__D1,#0F9H MOV SEND__D2,#00 CALL SEND_CV2653 JMP DPR2653_END MUTE_DIS: ; MOV DISPLAY_COM2,DISPLAY_COMC ; ORL DISPLAY_COM2,#02H ; lit off Mute LED CLR MUTE_ENABLE ; set Mute_pin to L MOV SEND__D1,#0F8H MOV SEND__D2,#00 MOV DISPLAY_COM0,DISPLAY_COMA MOV DISPLAY_COM1,DISPLAY_COMB MOV DISPLAY_COMA,#00 MOV DISPLAY_COMB,#00 CALL SEND_CV2653 JMP DPR2653_END ;--------------------------- ;DPR2653_RECOMMEND: ; JB BIT_FLAG.6,DPR2653_END5 ; MOV DISPLAY_COM0,#06 ; MOV DISPLAY_COM1,#03 ; MOV CONST_1,#035 ; MOV VOL_SL,#57 ; MOV VOL_SR,#57 ; MOV VOL_FL,#57 ; MOV VOL_FR,#57 ; MOV VOL_CEN,#57 ; MOV VOL_SUB,#57 ; MOV VOL_MAS,#57 ; JMP DPR2653_VOLUME_HI DPR2653_END5: JMP DPR2653_END DPR2653_DVD_CD: MOV C,DVD_CD_F JNC DPR2653_CD DPR2653_DVD: JB BIT_FLAG.6,DPR2653_END6 CALL DATA_CLR CLR DVD_CD_F ; CLR P3.1 ANL DISPLAY_COM2,#07EH JMP DPR2653_END DPR2653_END6: JMP DPR2653_END DPR2653_CD: DPR2653_TAPE: JB BIT_FLAG.6,DPR2653_END6 ;检测是否在MUTE 状态 CALL DATA_CLR SETB DVD_CD_F ; SETB P3.1 ORL DISPLAY_COM2,#01H JMP DPR2653_END DPR2653_END4: JMP DPR2653_END DPR2653_VOLUME_H: DPR2653_VOLUME_H2: JB BIT_FLAG.6,DPR2653_END4 DPR2653_VOLUME_H3: MOV CONST_1,VOL_MAS DPR2653_VOLUME_HI: CALL COM2653_UP JMP DPR2653_VOLUME_RTN_H DPR2653_VOLUME_L: DPR2653_VOLUME_L2: JB BIT_FLAG.6,DPR2653_END4 DPR2653_VOLUME_RTN_L: MOV CONST_1,VOL_SL CALL COM2653_DOWN ORL SEND__D1,#00H ORL SEND__D2,#10H CALL SEND_CV2653 ; RL ANL SEND__D1,#0FH ORL SEND__D1,#20H ANL SEND__D2,#0FH ORL SEND__D2,#30H CALL SEND_CV2653 ; RR MOV VOL_SL,CONST_1 MOV CONST_1,VOL_FL CALL COM2653_DOWN ANL SEND__D1,#0FH ORL SEND__D1,#80H ANL SEND__D2,#0FH ORL SEND__D2,#90H CALL SEND_CV2653 ; FL ANL SEND__D1,#0FH ORL SEND__D1,#40H ANL SEND__D2,#0FH ORL SEND__D2,#50H CALL SEND_CV2653 ; FR MOV VOL_FL,CONST_1
This post is from MCU
 
 
 

1379

Posts

0

Resources
4
 
MOV CONST_1,VOL_CEN CALL COM2653_DOWN ANL SEND__D1,#0FH ORL SEND__D1,#60H ANL SEND__D2,#0FH ORL SEND__D2,#70H CALL SEND_CV2653 ; CEN MOV VOL_CEN,CONST_1 MOV CONST_1,VOL_SUB CALL COM2653_DOWN ANL SEND__D1,#0FH ORL SEND__D1,#0A0H ANL SEND__D2,#0FH ORL SEND__D2,#0B0H CALL SEND_CV2653 ; SW MOV VOL_SUB,CONST_1 MOV CONST_1,VOL_MAS CALL COM2653_DOWN MOV VOL_MAS,CONST_1 ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FDH ; lit on Valume_LED MOV MODE_FLAG,#00 JMP DPR2653_END DPR2653_END9: JMP DPR2653_END DPR2653_VOLUME_RTN_H: MOV ACC,VOL_MAS XRL ACC,#79 JZ DPR2653_END9 MOV CONST_1,VOL_SL CALL COM2653_UP ORL SEND__D1,#00H ORL SEND__D2,#10H CALL SEND_CV2653 ; RL ANL SEND__D1,#0FH ORL SEND__D1,#20H ANL SEND__D2,#0FH ORL SEND__D2,#30H CALL SEND_CV2653 ; RR MOV VOL_SL,CONST_1 MOV CONST_1,VOL_FL CALL COM2653_UP ANL SEND__D1,#0FH ORL SEND__D1,#80H ANL SEND__D2,#0FH ORL SEND__D2,#90H CALL SEND_CV2653 ; FL ANL SEND__D1,#0FH ORL SEND__D1,#40H ANL SEND__D2,#0FH ORL SEND__D2,#50H CALL SEND_CV2653 ; FR MOV VOL_FL,CONST_1 MOV CONST_1,VOL_CEN CALL COM2653_UP ANL SEND__D1,#0FH ORL SEND__D1,#60H ANL SEND__D2,#0FH ORL SEND__D2,#70H CALL SEND_CV2653 ; CEN MOV VOL_CEN,CONST_1 MOV CONST_1,VOL_SUB CALL COM2653_UP ANL SEND__D1,#0FH ORL SEND__D1,#0A0H ANL SEND__D2,#0FH ORL SEND__D2,#0B0H CALL SEND_CV2653 ; SW MOV VOL_SUB,CONST_1 MOV CONST_1,VOL_MAS CALL COM2653_UP MOV VOL_MAS,CONST_1 ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FDH ; lit on Valume_LED MOV MODE_FLAG,#00 JMP DPR2653_END DPR2653_VOLUME_H4: JB BIT_FLAG.6,DPR2653_VOLUME_H5 ;检测是否在MUTE 状态 DEC VOL_MAS MOV CONST_1,VOL_MAS CALL COM2653_UP MOV VOL_MAS,CONST_1 ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FDH ; lit on Valume_LED MOV MODE_FLAG,#00 DPR2653_VOLUME_H5: RET ;--------------------------- DPR2653_FRONT_H: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 DPR2653_FRONT_H1: MOV CONST_1,VOL_FL CALL COM2653_UP JMP DPR2653_FRONT_RTN DPR2653_FRONT_L: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 MOV CONST_1,VOL_FL CALL COM2653_DOWN DPR2653_FRONT_RTN: MOV VOL_FL,CONST_1 MOV VOL_FR,CONST_1 ANL SEND__D1,#0FH ORL SEND__D1,#80H ANL SEND__D2,#0FH ORL SEND__D2,#90H CALL SEND_CV2653 ; FL ANL SEND__D1,#0FH ORL SEND__D1,#40H ANL SEND__D2,#0FH ORL SEND__D2,#50H CALL SEND_CV2653 ; FR ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0FBH ; lit on Front_LED MOV MODE_FLAG,#01 JMP DPR2653_END DPR2653_END1: JMP DPR2653_END ;--------------------------- DPR2653_REAR_H: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 DPR2653_REAR_H1: MOV CONST_1,VOL_SL CALL COM2653_UP JMP DPR2653_REAR_RTN DPR2653_REAR_L: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 MOV CONST_1,VOL_SL CALL COM2653_DOWN DPR2653_REAR_RTN: MOV VOL_SL,CONST_1 MOV VOL_SR,CONST_1 ANL SEND__D1,#0FH ORL SEND__D1,#00H ANL SEND__D2,#0FH ORL SEND__D2,#10H CALL SEND_CV2653 ; RL ANL SEND__D1,#0FH ORL SEND__D1,#20H ANL SEND__D2,#0FH ORL SEND__D2,#30H CALL SEND_CV2653 ; RR ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0EFH ; lit on Rear_LED MOV MODE_FLAG,#03 JMP DPR2653_END ;--------------------------- DPR2653_CENTER_H: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 DPR2653_CENTER_H1: MOV CONST_1,VOL_CEN CALL COM2653_UP JMP DPR2653_CENTER_RTN DPR2653_CENTER_L: JB BIT_FLAG.6,DPR2653_END1 ;检测是否在MUTE 状态 MOV CONST_1,VOL_CEN CALL COM2653_DOWN DPR2653_CENTER_RTN: MOV VOL_CEN,CONST_1 ANL SEND__D1,#0FH ORL SEND__D1,#60H ANL SEND__D2,#0FH ORL SEND__D2,#70H CALL SEND_CV2653 ; CEN ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0F7H ; lit on Center_LED MOV MODE_FLAG,#02 JMP DPR2653_END ;--------------------------- DPR2653_SUBWF_H: JB BIT_FLAG.6,DPR2653_END3 ;检测是否在MUTE 状态 DPR2653_SUBWF_H1: MOV CONST_1,VOL_SUB CALL COM2653_UP JMP DPR2653_SUBWF_RTN DPR2653_SUBWF_L: JB BIT_FLAG.6,DPR2653_END3 ;检测是否在MUTE 状态 MOV CONST_1,VOL_SUB CALL COM2653_DOWN DPR2653_SUBWF_RTN: MOV VOL_SUB,CONST_1 ; ANL SEND__D1,#0FH ORL SEND__D1,#0A0H ; ANL SEND__D2,#0FH ORL SEND__D2,#0B0H CALL SEND_CV2653 ; SW ORL DISPLAY_COM2,#7EH ; lit off other LED ANL DISPLAY_COM2,#0DFH ; lit on SUBWF_LED MOV MODE_FLAG,#04 JMP DPR2653_END DPR2653_END3: JMP DPR2653_END DPR2653_END: MOV DELAY_H,#82H MOV DELAY_L,#58H JB KEY_FLAG.6,DPR2653_END2 JMP PINT_RTN DPR2653_END2: JMP KEY_PROCESS_END ;=============================================================== COM2653_UP: ; subrouting MOV ACC,CONST_1 CLR C SUBB A,#079 JNC UP_OVERFLOW INC CONST_1 JMP GENERATE_DISPDATA UP_OVERFLOW: MOV CONST_1,#079 JMP GENERATE_DISPDATA ;------------------- COM2653_DOWN: MOV ACC,CONST_1 JZ GENERATE_DISPDATA DEC CONST_1 ; JMP GENERATE_DISPDATA ;------------------- GENERATE_DISPDATA: MOV ACC,CONST_1 SWAP A ANL A,#0FH MOV DISPLAY_COM1,ACC MOV ACC,CONST_1 ANL A,#0FH ADD A,#00H ; clear C, AC DA A MOV DISPLAY_COM0,ACC GENERATE_LOOPS: MOV ACC,DISPLAY_COM1 JZ GENERATE_ENDS DEC DISPLAY_COM1 MOV ACC,DISPLAY_COM0 ADD A,#16H DA A MOV DISPLAY_COM0,ACC SJMP GENERATE_LOOPS GENERATE_ENDS: MOV REPLACE_VAR,DISPLAY_COM0 ; !!!!! MOV ACC,DISPLAY_COM0 SWAP A ANL A,#0FH MOV DISPLAY_COM1,ACC ANL DISPLAY_COM0,#0FH ; RET ;------------------- GENERATE_SENDDATA: CLR C MOV ACC,#79H SUBB A,REPLACE_VAR DA A MOV SEND__D2,ACC SWAP A ANL A,#0FH MOV SEND__D1,ACC ANL SEND__D2,#0FH RET ;********************************************************************** ; Data transmitte subroute (to 2322 & 2323) ; ;********************************************************************** SEND_CV2653: CALL DELAY_10US CALL DELAY_10US ANL SEND_FLAG,#0FH SEND_START: SETB P3.1 ;SET "CLK" TO "H" CALL DELAY_10US SETB P3.0 ;SET "SDA" TO "H" CALL DELAY_10US CLR P3.0 ;SET "SDA" TO "L" CALL DELAY_10US CLR P3.1 ;SET "CLK" TO "L" CALL DELAY_10US ; INC SEND_FLAG JB SEND_FLAG.2,SEND_END SEND_DATA1_2: MOV REPLACE_VAR,#88H CALL SEND_BYTE JB SEND_FLAG.7,SEND_CV2653 MOV REPLACE_VAR,SEND__D1 CALL SEND_BYTE JB SEND_FLAG.7,SEND_CV2653 MOV ACC,SEND__D2 JZ SEND_END SEND_DATA3: MOV REPLACE_VAR,SEND__D2 CALL SEND_BYTE JB SEND_FLAG.7,SEND_CV2653 SEND_END: CLR P3.0 ;SET "SDA" TO "L" CALL DELAY_10US SETB P3.1 ;SET "CLK" TO "H" CALL DELAY_10US SETB P3.0 ;SET "SDA" TO "H" CALL DELAY_10US MOV SEND_FLAG,#00 ; MOV C,DVD_CD_F ; MOV P3.1,C ; CLR P3.1 RET ;------------------------------------------------- SEND_BYTE: NOP NOP MOV A,REPLACE_VAR RLC A MOV REPLACE_VAR,A JC SEND_DATA_1 SEND_DATA_0: CLR P3.0 SJMP SEND_DATA_C SEND_DATA_1: SETB P3.0 NOP SEND_DATA_C: CALL DELAY_10US SETB P3.1 CALL DELAY_10US CALL DELAY_10US CLR P3.1 ; CALL DELAY_10US MOV A,SEND_FLAG ADD A,#10H MOV SEND_FLAG,A JNB SEND_FLAG.7,SEND_BYTE ; CALL DELAY_10US SETB P3.1 ;"CLK" TO "H" CALL DELAY_10US SETB P3.0 ;SET "SDA" TO "H" CALL DELAY_10US MOV C,P3.0 ;READ P3.0 pin for ACK_chk MOV SEND_FLAG.7,C CLR P3.1 ; SET "CLK" TO "L" CALL DELAY_10US CLR P3.0 ; SET "SDA" TO "L" ; CALL DELAY_10US RET ;------------------------------------------------ ;指令延时程序: DELAY_10US: NOP NOP NOP NOP NOP NOP NOP NOP NOP nop nop RET DELAY_300MM: MOV DELAY_A,#0FFH DL2: MOV DELAY_B,#0FFH DL1: NOP NOP DJNZ DELAY_B,DL1 DJNZ DELAY_A,DL2 RET ;********************************************************************** ; <<---- PROGRAM END ---->> ; ;********************************************************************** ; NOP ; NOP ; NOP ;====================================================================== END
This post is from MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list