您当前的位置:五五电子网电子知识单片机-工控设备MSP430单片机MSP430超声波测距 正文
MSP430超声波测距

MSP430超声波测距

点击数:7426 次   录入时间:03-04 11:57:49   整理:http://www.55dianzi.com   MSP430单片机
             inc.b   R15
             MOV .b   R12,0(R15)              ; Low nibble segments c & d to LCD
             rra.w   R12
             inc.b   R15
             MOV .b   R12,0(R15)              ; Low nibble segments e & f to LCD
             rra.w   R12
             inc.b   R15
             MOV .b   R12,0(R15)              ; Low nibble segments g & h to LCD
             rra.w   R12
             inc.b   R15             
             MOV .b   LCD_Tab(R13),R12        ; High nibble to LCD digit 2
             MOV .b   R12,0(R15)              ; High nibble segments a & b to LCD
             rra.w   R12
             inc.b   R15
             MOV .b   R12,0(R15)              ; High nibble segments c & d to LCD
             rra.w   R12
             inc.b   R15
             MOV .b   R12,0(R15)              ; High nibble segments e & f to LCD
             rra.w   R12
             inc.b   R15
             MOV .b   R12,0(R15)              ; High nibble segments g & h to LCD
             rra.w   R12                                     
             ret                                                       
;******************************************************************************
;            LCD Type Definition
;******************************************************************************
;Segments definition
a            equ     001h
b            equ     010h
c            equ     002h
d            equ     020h
e            equ     004h
f            equ     040h
g            equ     008h
h            equ     080h
Blank        equ     000h
           
LCD_Tab      db      a+b+c+d+e+f             ; Displays "0"
             db      b+c                     ; Displays "1"
             db      a+b+d+e+g               ; Displays "2"
             db      a+b+c+d+g               ; Displays "3"
             db      b+c+f+g                 ; Displays "4"
             db      a+c+d+f+g               ; Displays "5"
             db      a+c+d+e+f+g             ; Displays "6"
             db      a+b+c                   ; Displays "7"
             db      a+b+c+d+e+f+g           ; Displays "8"
             db      a+b+c+d+f+g             ; Displays "9"
             db      a+b+c+e+f+g             ; Displays "A"
             db      Blank                   ; Displays  Blank
             db      a+d+e+f                 ; Displays "C"
             db      b+c+d+e+g               ; Displays "D" d
             db      a+d+e+f+g               ; Displays "E"
             db      a+e+f+g                 ; Displays "F"
;******************************************************************************
Delay;       SOFtware delay
;******************************************************************************
             push    #0FFFFh                 ; Delay to TOS
DL1          dec.w   0(SP)                   ; Decrement TOS
             jnz     DL1                     ; Delay over?
             incd    SP                      ; Clean TOS
             ret                             ; Return from subroutine
           
;******************************************************************************
Math_calc;   calculation subroutine
;******************************************************************************

上一页  [1] [2] [3] [4] [5] [6] [7]  下一页


本文关键字:超声波  MSP430单片机单片机-工控设备 - MSP430单片机