TAILIEUCHUNG - Interfacing PIC Microcontrollers 28

Interfacing PIC Microcontrollers 28. 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 SUBROUTINES Routine to scan 3x4 phone key pad Returns ASCII code in W Output rows RB2 RB4 RB5 RC5 Input cols RC0 RC1 RC2 keyin NOP BANKSEL TRISC MOVLW B 10010111 Port C code for MOVWF TRISC rows and columns BANKSEL PORTC BSF PORTB 2 Set BSF PORTB 4 rows BSF PORTB 5 high BSF PORTC 5 initially BSF Cont 0 Counter not zero CLRF Test No key Scan keyboard again CLRW No key yet BCF PORTB 2 Row 1 NOP wait NOP BTFSS PORTC 0 key pressed MOVLW 1 yes - load ASCII BTFSS PORTC 1 next MOVLW 2 etc BTFSS PORTC 2 MOVLW 3 BSF PORTB 2 deselect row BCF PORTB 4 second row BTFSS PORTC 0 MOVLW 4 BTFSS PORTC 1 MOVLW 5 BTFSS PORTC 2 MOVLW 6 BSF PORTB 4 BCF PORTB 5 third row BTFSS PORTC 0 MOVLW 7 BTFSS PORTC 1 MOVLW 8 BTFSS PORTC 2 MOVLW 9 BSF PORTB 5 BCF PORTC 5 fourth row BTFSS PORTC 0 MOVLW BTFSS PORTC 1 MOVLW 0 BTFSS PORTC 2 MOVLW BSF PORTC 5 Test key MOVWF Test get code MOVF Test F test it BTFSS STATUS Z if code found GOTO once beep once MOVF Key W load key code and RETURN if no key Check if beep done once MOVF Cont F beep already done BTFSC STATUS Z GOTO again yes - scan again MOVF Test W store key MOVWF Key Beep beep MOVLW 10 10 cycles MOVWF Cont buzz BSF PORTB 0 one beep cycle CALL onems 2ms BCF PORTB 0 CALL onems DECFSZ Cont last cycle GOTO buzz no GOTO again yes Program Continued 256 System Design Display input test voltage on top line of LCD putdec BCF Select RS set display command mode MOVLW 0 80 code to home cursor CALL send output it to display BSF Select RS and restore data mode Convert digits to ASCII MOVLW 0 30 load ASCII offset ADDWF Huns convert hundreds to ASCII ADDWF Tens convert tens to ASCII ADDWF Ones convert ones to ASCII Display voltage on line 1 CALL volmes Display text on line 1 MOVF Huns W load hundreds code CALL send and send to display MOVLW . load point code CALL send and output MOVF Tens W load tens code CALL send and output MOVF Ones W load ones code CALL send and output MOVLW load space code CALL send and output MOVLW V

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.