;***************************************************** ;Company : ;File Name : 123.asm ;Author : ;Create Data : 2009-05-11 ;Last Modified : 2009-05-11 ;Description : ;Version : 1.0 list p=6612 ;***************************************************** ie equ 00h irq equ 01h tm0 equ 02h tl0 equ 04h th0 equ 05h p0 equ 08h p1 equ 09h p2 equ 0ah setting equ 13h fae equ 14h duty equ 15h tbr equ 0eh inx equ 0fh dpl EQU 10H ;INX 数据指针低四位 dpm EQU 11H ;INX 数据指针中三位 dph EQU 12H ;INX 数据指针高三位 /////////////////////////// setp_bak equ 20h test equ 21h key_cnt equ 22h delay_1 equ 23h delay_2 equ 24h ct0 equ 25h x equ 26h x_ac equ 27h y equ 28h z equ 29h setp equ 30h numb equ 31h x1 equ 33h x1_ac equ 34h y1 equ 35h z1 equ 36h setp_bak1 equ 3AH setp_bak2 equ 3bH setp_bak3 equ 3ch /////////////////////// seg1 equ 300h seg2 equ 301h seg3 equ 302h seg4 equ 303h seg5 equ 304h seg6 equ 305h seg7 equ 306h seg8 equ 307h seg9 equ 308h seg10 equ 309h seg11 equ 30ah seg12 equ 30bh seg13 equ 30ch seg14 equ 30dh seg15 equ 30eh seg16 equ 30fh seg17 equ 310h seg18 equ 311h seg19 equ 312h /////////////////////////// ORG 0000H ;TODO: Add your assembly code here jmp sys_reset org 0001h;exint rtni org 0002h;t0_int rtni org 0003h;t1_int rtni org 0004h;pbc_int rtni org 0020H ////////////Ram_inti//////////////////// sys_reset: ldi delay_1,0 ldi delay_2,0 ldi ct0,0 ldi x_ac,0 ldi x,0 ldi y,0 ldi z,0 ldi x1_ac,0 ldi x1,0 ldi y1,0 ldi z1,0 ldi setp,0 ldi setp_bak,0 ldi setp_bak1,0 ldi setp_bak2,0 ldi setp_bak3,0 ldi p0,1111b ldi p1,1111b ldi p2,1111b ldi setting,0000b ldi duty,0 ////////////////////////////////////// CLR_LCD: LDI dpl,03H LDI dpm,00H LDI dph,06H CLR_LCD_1: LDI inx,00H ADIM dpl,01H CLR_LCD_2: SBI dpl,0fH BNZ CLR_LCD_1 work_start: ///////////// call delay_ct call lcd_disp call delay_ct /////////////////////////// work_start1: ldi setp,0 adim x,01h sta x_ac sbi x,0ah bnc work_start ldi x,0 jmp sys_reset //////////////lcd show count number//////////////// lcd_disp: /////////first_lcd////////////////// first: lda setp_bak sta setp sbi x,05h bnc jx ////////////// ;call delay_ct jmp lcd_h_disp;=5 goto h ;call delay_ct ///////////// jmp work_start;1 jx: ;<=4 andim x,1111b baz $+2 ;if a=0? jmp lcd_disp_1 ; adim x_ac,01h ;+1 ldi setp,00h ///////////<=4//////////////// lcd_disp_1: /////////////show com0 adim setp,01h ldi tbr,0fh lda setp call 07f0h sta seg13 /////////////show com1 adim setp,01 ldi tbr,0fh lda setp call 07f0h sta seg14 /////////////show com2 adim setp,01 ldi tbr,0fh lda setp call 07f0h sta seg15 lda setp sta setp_bak andim setp,0 rtni /////////////>=5///////////// lcd_h_disp: sbi x,05 baz five_cl jmp lcd_disp_h five_cl: andim setp,0 andim setp_bak1,0 lcd_disp_h: /////////// show com0 lda setp_bak1 sta setp adim setp,01h ldi tbr,0eh lda setp call 07e0h sta seg13 ////////////show com1 adim setp,01 ldi tbr,0eh lda setp call 07e0h sta seg14 ////////////show com2 adim setp,01 ldi tbr,0eh lda setp call 07e0h sta seg15 lda setp sta setp_bak1 rtni ///////////////////////////////////////// ;lcd shine delay /////////////disp_lcd_delay///////// delay_ct: ldi ct0,05h ////////key_delay/////// delay: LDI delay_1,09H ;1 LDI delay_2,0EH ;1 SBIM delay_2,01H;1 2*15+1 BC $-1 ; SBIM delay_1,01H;1 bC $-4 ;1 4*(2*15+1)+1 sbim ct0,01h ;1 8*[4*(2*15+1)+1]+1 bc $-7 ;1 RTNI ;1 5*{8*[4*(2*15+1)+1]+1} //// 显示数据表:根据LCD 的矩阵表定出数据表 //// 是按cb gda ef 来建立的 org 07f0h tjmp //07f0h rtnw 1111b,0101b //0//07f1h rtnw 1111b,0011b //07f2h rtnw 1111b,0101b //07f3h rtnw 1111b,0000b //1 rtnw 1111b,0000b rtnw 1111b,0101b rtnw 1111b,0100b //2 rtnw 1111b,0111b rtnw 1111b,0001b
rtnw 1111b,0000b //3 rtnw 1111b,0111b //fa rtnw 1111b,0101b rtnw 1111b,0001b //4 rtnw 1111b,0100b rtnw 1111b,0101b //ff
org 07e0h tjmp rtnw 1110b,0001b //5 rtnw 1110b,0111b rtnw 1110b,0100b
rtnw 1110b,0101b // rtnw 1110b,0111b rtnw 1110b,0100b rtnw 1110b,0000b //7 rtnw 1110b,0001b rtnw 1110b,0101b rtnw 1110b,0101b //8 rtnw 1110b,0111b rtnw 1110b,0101b rtnw 1110b,0001b //9 rtnw 1110b,0111b rtnw 1110b,0101b//ff ;****************************** END |