请各位大大赐教。这是我们微机课程的单片机代码,用单片机向外发指令码,指令码很少所以就直接置入地址了。程序在keil上仿真的时候通过模拟串口输出没有问题,但是烧到开发板上后串口输出端完全没有反应,已经排除开发板的故障。请各位大大赐教!
org 0000h ljmp main
org 0200h main: mov TMOD,#20h mov r0,#40h mov 60h,#30h ; 0 mov 61h,#31h ; 1 mov 62h,#35h ; 5 mov 63h,#0dh ; 0d and 0a are stop bits mov 64h,#0ah mov 65h,#41h ; A mov 66h,#54h ; T mov 67h,#5Ah ; Z mov sp,#60h mov scon,#50H
mov pcon,#80h mov tl1,#0fah mov th1,#0fah setb tr1 mov p3,#11111111b
choose: mov r0,#40h mov 60h,#30h ; 0 mov 61h,#31h ; 1 mov 62h,#35h ; 5 mov 63h,#0dh ; 0d and 0a are stop bits mov 64h,#0ah mov 65h,#41h ; A mov 66h,#54h ; T mov 67h,#5Ah ; Z jnb p3.0,jump1 jump1: jnb p3.4,fuwei jnb p3.5,again sjmp choose
fuwei:
mov a,65h mov sbuf,a jnb ti,$ clr ti
mov a,66h mov sbuf,a jnb ti,$ clr ti
mov a,67h mov sbuf,a jnb ti,$ clr ti
mov a,63h mov sbuf,a jnb ti,$ clr ti
mov a,64h mov sbuf,a jnb ti,$ clr ti
againfuwei:jnb ri,$ clr ri mov a,sbuf cjne a,#0Ah,againfuwei ljmp choose
again: mov a,60h mov sbuf,a jnb ti,$ clr ti
mov a,61h mov sbuf,a jnb ti,$ clr ti
mov a,60h mov sbuf,a jnb ti,$ clr ti
mov a,62h mov sbuf,a jnb ti,$ clr ti
mov a,63h mov sbuf,a jnb ti,$ clr ti
mov a,64h mov sbuf,a jnb ti,$ clr ti
again1:jnb ri,$ clr ri mov a,sbuf mov @r0,a inc r0 cjne a,#0Ah,again1
mov a,46h cjne A,#40h,L1 L1:jc L2 clr c subb a,#37h mov 46h,a
second: mov a,47h cjne A,#40h,L3 L3:jc L4 clr c subb a,#37h mov 47h,a
third: mov a,49h cjne A,#40h,L5 L5:jc L6 clr c subb a,#37h mov 49h,a
fourth: mov a,4Ah cjne A,#40h,L7 L7:jc L8 clr c subb a,#37h mov 4Ah,a ljmp paixu
L2:clr c subb a,#30h mov 46h,a ljmp second
L4:clr c subb a,#30h mov 47h,a ljmp third
L6:clr c subb a,#30h mov 49h,a ljmp fourth
L8:clr c subb a,#30h mov 4Ah,a ljmp paixu paixu: clr c mov a,46h rlc a rlc a rlc a rlc a add a,47h mov 46h,a; gaowei clr c mov a,49h rlc a rlc a rlc a rlc a add a,4Ah mov 47h,a; diwei
clr c mov a,46h rrc a mov 50h,a mov a,47h rrc a mov 51h,a clr c mov a,50h rrc a mov 50h,a mov a,51h rrc a mov 51h,a mov th1,50h ;high mov tl1,51h MOV 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,r1 mov 40h,r0 ljmp choose
end
|