Interfacing PIC Microcontrollers 12

Interfacing PIC Microcontrollers 12. Explore in detail microcontroller interfacing techniques using the popular PIC 16F877 Work through step-by-step examples interactively using circuit simulation software, supplied as assembly source code Gain the knowledge of a wide range of peripheral devices such as keyboards, displays, sensors and drives and serial communication with other processors, memory and more Use interactive simulation software to design and test circuits. | Interfacing PIC Microcontrollers Messi MOVF Point W and load it CALL Linei Get ASCII code from table CALL Send and do it INCF Point point to next character MOVF Point W and load the pointer SUBLW D 16 check for last table item BTFSS STATUS Z and finish if 16 done GOTO Mess1 Output character code MOVLW 0xC0 Move cursor to line 2 BCF Select RS Select command mode CALL Send and send code CLRF Point Reset table pointer Mess2 MOVF Point W and load it CALL Line2 Get fixed character BSF Select RS Select data mode CALL Send and send code INCF Point next character MOVF Point W Reload pointer SUBLW D 11 and check for last BTFSS STATUS Z Skip if last GOTO Mess2 or send next RETURN done Output variable count to display 0-9 endlessly OutVar CLRF Var Clear variable number MOVLW 0X3 0 Load offset to be added ADDWF Var to make ASCII code 30-39 Next MOVF Var W Load the code BSF Select RS Select data mode CALL Send and send code MOVLW 0xCB code to move cursor back BCF Select RS Select command mode CALL Send and send code MOVLW D 250 Load count to wait 250ms CALL Xms so numbers are visible INCF Var Next number MOVF Var W Load number SUBLW 0x3A Check for last 10 A BTFSS STATUS Z and skip if last GOTO Next or do next number GOTO OutVar Repeat from number Z Start CALL Init Initialise the display CALL OutMes Display fixed characters GOTO OutVar Display an endless count END of source code Program Continued The fixed messages are generated from program data tables using ADDWF PCL to jump into the table using the number in W and RETLW to return the ASCII codes. The assembler generates the ASCII code in response to the single quotes which enclose the character. To fetch the required code the table pointer is added to the program counter at the top of the table. The table pointer is also checked each time to see the end of the table has been reached. The output variable is just a count from 0 to 9 but to obtain the corresponding ASCII code 30h must be added because the ASCII for 0 is 30h

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.