To convert Millimeters to Inches, Divide by 25.4 or multiply by .03937.
See http://www.piclist.com/cgi-bin/constdivmul.exe
For an eight bit value...
; ACC = ACC * 0.03937 ; Temp = TEMP ; ACC size = 8 bits ; Error = 0.5 % ; Bytes order = little endian ; Round = no ; ALGORITHM: ; Clear accumulator ; Add input / 32 to accumulator ; Add input / 128 to accumulator ; Add input / 4096 to accumulator ; Move accumulator to result ; ; Approximated constant: 0.0393066, Error: 0.160933 % ; Input: ACC0, 8 bits ; Output: ACC0, 4 bits ; Code size: 20 instructions cblock ACC0 TEMP0 endc ;copy accumulator to temporary movf ACC0, w movwf TEMP0 ;shift accumulator right 5 times swapf ACC0, w andlw 0x0F movwf ACC0 clrc rrf ACC0, f ;add temporary to accumulator movf TEMP0, w addwf ACC0, f ;shift accumulator right 2 times rrf ACC0, f clrc rrf ACC0, f ;add temporary to accumulator addwf ACC0, f ;shift accumulator right 5 times swapf ACC0, w andlw 0x0F movwf ACC0 skpnc bsf ACC0, 4 clrc rrf ACC0, f ; Generated by www.piclist.com/cgi-bin/constdivmul.exe (November 17, 2000 version) ; Tue Apr 03 14:37:32 2001 GMT
file: /Techref/microchip/math/convmilinch.htm, 1KB, , updated: 2001/4/3 08:39, local time: 2024/11/21 22:26,
3.15.228.171:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/microchip/math/convmilinch.htm"> PIC Microcontoller Math Library Methods for Conversion of Millimeters to Inches</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.