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
;================================================ ;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