本帖最後由 小富 於 2009-9-14 01:11 編輯
我用8051寫校正模式的程式跟TDCM3用串列傳輸接收TDCM3的資料能接收到41H、43H顯示在LCD上但4BH就是抓不到所以後面52H、44H、59H也都抓不到,請大大我看一下問題出在哪謝謝!!!
我用Kile c寫的
EXTRN CODE(WLCD_COMMAND)
EXTRN CODE(WLCD_DATA)
EXTRN CODE(SET_LCD)
EXTRN CODE(CLEAR_LCD)
EXTRN CODE(DISP_LCD_CHAR)
;------------------------------------------------
RTS EQU P3.7
RX EQU P3.6
;------------------------------------------------
ORG 00H
JMPSTART
;------------------------------------------------
START:
CALL SET_LCD
CALL CLEAR_LCD
SETB RTS
SETB RX
RS232:
MOV TMOD,#00100001B
MOV TH1,#-03
MOV SCON,#01010000B
SETB TR1
CLR RI
CLR TI
RUN:
MOV R2,#80H
CALL WLCD_COMMAND
CLR RX
CLR RTS
MOV R5,#1 ;呼叫延遲副程式,延遲1ms
CALL DELAY
SETB RTS
JNB RI,$
CLR RI
MOV A,SBUF ;收到41H
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示41
JNB RI,$
CLR RI
MOV A,SBUF;收到43H
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示43
JNB RI,$
CLR RI
MOV A,SBUF;收到4BH
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示4B
MOV R5,#16 ;呼叫延遲副程式,延遲16ms
CALL DELAY
SETB RX
JNB RI,$
CLR RI
MOV A,SBUF ;收到52H
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示52
JNB RI,$
CLR RI
MOV A,SBUF;收到44H
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示44
JNB RI,$
CLR RI
MOV A,SBUF;收到59H
MOV R1,A
CALL DISP_LCD_CHAR ;LCD上顯示59
JMP RUN
;------------------------------------------------
;延遲副程式: R5*1ms
;------------------------------------------------
DELAY:
MOV R6,#2
MOV R7,#249
DJNZ R7,$
DJNZ R6,$
DJNZ R5,DELAY
RET |