; : , ; : String,Destiny_ ; : ; , : ; Print 'First string',UART ; UART ; Print 'Second string',LCD ; LCD UART equ 0 LCD equ 1 Print macro String;,Destiny_ ; String - , Destiny_ - : Display UART mov destiny,#Destiny_ call Output ; . 1 db String,0Dh,0Ah,0 endm Print_data segment data rseg Print_data destiny: ds 1 Print_code segment code rseg Print_code Output: ; , pop DPH ; DPTR , pop DPL ; Loop_Output: clr A movc A, @A+DPTR ; inc DPTR ; jnz Output_Symbol ; , jmp @A+DPTR ; Output_Symbol: ;------ UART ------------------------- push ACC ; , mov A, Destiny jz Out_UART ; Out_LCD: pop ACC ; call Out_2_LCD ; jmp Loop_Output ; Out_UART: pop ACC ; jnb TI, $ ; clr TI ; , mov SBUF, A ; jmp Loop_Output ;
; : , ; : String,Label,waiting_value ; : jmp Label String ; , : ; Parsing 'First string',UART_Error,1000 ; UART 1000 , , UART_Error ; Parsing 'Second string',UART_Error,0 ; UART, , UART_Error, - Parsing macro String,Label,waiting_value ; String - , Label - , waiting_value - *100 ( 11,0592 MHz) mov parsing_delay,#waiting_value ; - 100 , - 25,5 call Intput ; . 1 db String,0Dh,0Ah,0 jbc parsing_error,Label ; endm Parsing_data segment data rseg Parsing_data parsing_delay: ds 3 Parsing_bit segment bit rseg Parsing_bit parsing_error: dbit 1 Parsing_code segment code rseg Parsing_code Intput: ; , clr RI ; , , pop DPH ; DPTR , pop DPL ; 1 Loop_Intput: clr A movc A, @A+DPTR ; inc DPTR ; jnz Wait ; , jmp @A+DPTR ; . DPTR , Wait: ; push ACC ; mov A, parsing_delay jz Always_Wait ; = 0, mov parsing_delay+2,#0 mov parsing_delay+1,#90 ; 11,0592 Loop_Wait: jb RI, Stop_Wait ; , djnz parsing_delay+2,Loop_Wait jb RI, Stop_Wait djnz parsing_delay+1,Loop_Wait jb RI, Stop_Wait mov parsing_delay+1,#90 ; 11,0592 djnz parsing_delay,Loop_Wait ; pop ACC ; , jmp Error_Intput ; Always_Wait: jnb RI, $ ; Stop_Wait: mov parsing_delay,SBUF ; clr RI pop ACC ; cjne A,parsing_delay,Error_Intput ; 1 , jmp Loop_Intput ; Error_Intput: ; , clr A movc A, @A+DPTR inc DPTR jnz Error_Intput ; setb parsing_error ; jmp @A+DPTR ; . DPTR ,
Source: https://habr.com/ru/post/337168/
All Articles