请各位大大赐教。这是我们微机课程的
单片机代码,用单片机向外发指令码,指令码很少所以就直接置入地址了。程序在keil上
仿真的时候通过模拟串口输出没有问题,但是烧到
开发板上后串口完全没有反应,已经排除开发板的故障。请各位大大赐教!
org 0000hljmp main
org 0200hmain:mov TMOD,#20hmov r0,#40hmov 60h,#30h ; 0mov 61h,#31h ; 1mov 62h,#35h ; 5mov 63h,#0dh ; 0d and 0a are stop bitsmov 64h,#0ahmov 65h,#41h ; Amov 66h,#54h ; Tmov 67h,#5Ah ; Zmov sp,#60hmov scon,#50H
mov pcon,#80hmov tl1,#0fahmov th1,#0fahsetb tr1mov p3,#11111111b
choose:mov r0,#40hmov 60h,#30h ; 0mov 61h,#31h ; 1mov 62h,#35h ; 5mov 63h,#0dh ; 0d and 0a are stop bitsmov 64h,#0ahmov 65h,#41h ; Amov 66h,#54h ; Tmov 67h,#5Ah ; Zjnb p3.0,jump1jump1:jnb p3.4,fuweijnb p3.5,againsjmp choose
fuwei:
mov a,65hmov sbuf,ajnb
ti,$clr ti
mov a,66hmov sbuf,ajnb ti,$clr ti
mov a,67hmov sbuf,ajnb ti,$clr ti
mov a,63hmov sbuf,ajnb ti,$clr ti
mov a,64hmov sbuf,ajnb ti,$clr ti
againfuwei:jnb ri,$clr rimov a,sbufcjne a,#0Ah,againfuweiljmp choose
again:mov a,60hmov sbuf,ajnb ti,$clr ti
mov a,61hmov sbuf,ajnb ti,$clr ti
mov a,60hmov sbuf,ajnb ti,$clr ti
mov a,62hmov sbuf,ajnb ti,$clr ti
mov a,63hmov sbuf,ajnb ti,$clr ti
mov a,64hmov sbuf,ajnb ti,$clr ti
again1:jnb ri,$clr rimov a,sbufmov @r0,ainc r0cjne a,#0Ah,again1
mov a,46hcjne A,#40h,L1L1:jc L2clr csubb a,#37hmov 46h,a
second:mov a,47hcjne A,#40h,L3L3:jc L4clr csubb a,#37hmov 47h,a
third:mov a,49hcjne A,#40h,L5L5:jc L6clr csubb a,#37hmov 49h,a
fourth:mov a,4Ahcjne A,#40h,L7L7:jc L8clr csubb a,#37hmov 4Ah,aljmp paixu
L2:clr csubb a,#30hmov 46h,aljmp second
L4:clr csubb a,#30hmov 47h,aljmp third
L6:clr csubb a,#30hmov 49h,aljmp fourth
L8:clr csubb a,#30hmov 4Ah,aljmp paixupaixu:clr cmov a,46hrlc arlc arlc arlc aadd a,47hmov 46h,a; gaoweiclr cmov a,49hrlc arlc arlc arlc aadd a,4Ahmov 47h,a; diwei
clr cmov a,46hrrc amov 50h,amov a,47hrrc amov 51h,aclr cmov a,50hrrc amov 50h,amov a,51hrrc amov 51h,amov th1,50h ;high mov tl1,51hMOV R0, TH1 MOV R1, TL1 CALL HEX2BCD ;HEX2BCD: CLR A MOV R2, A ;??? MOV R3, A MOV R4, A MOV R5, #16 ;???????LOOP: CLR C MOV A, R1 ;?????????????Cy RLC A MOV R1, A MOV A, R0 RLC A MOV R0, A MOV A, R4 ;??BCD???? ADDC A, R4 ;?????????,??????? DA A ;?????,??BCD? MOV R4, A MOV A, R3 ADDC A, R3 DA A MOV R3, A MOV A, R2 ADDC A, R2 MOV R2, A DJNZ R5, LOOP ;???????mov 44h,r4 ;shi ge mov 43h,r3 ;qian bai mov 42h,r2 ;wan mov 41h,r1mov 40h,r0 ljmp choose
end
一周热门 更多>