ON 20081008@5:23:06 AM at page: http://www.piclist.com/techref/microchip/math/bit/mask.htm#39729.224375 [mark_jeronimus-gmail-] Code: <PRE>Still, a simple table lookup or 8-bits is less instruction cycles and doesn't need a temp register. And it can do a little math too (set bit 7-WREG instead of bit WREG) GET_BIT ADDWF PCL,F RETLW B'00000001' RETLW B'00000010' RETLW B'00000100' RETLW B'00001000' RETLW B'00010000' RETLW B'00100000' RETLW B'01000000' RETLW B'10000000' GET_BIT2 ADDWF PCL,F RETLW B'10000000' RETLW B'01000000' RETLW B'00100000' RETLW B'00010000' RETLW B'00001000' RETLW B'00000100' RETLW B'00000010' RETLW B'00000001' </PRE> ON 20081008@5:38:33 AM at page: http://www.piclist.com/techref/microchip/math/bit/index.htm#39729.2351041667 [mark_jeronimus-gmail-] Code: /techref/microchip/math/bit/shift4.htm <PRE>Shift by 4 bits at a time</PRE> ON 20081008@5:42:30 AM at page: http://www.piclist.com/techref/microchip/math/bit/shift4.htm#39729.2378472222 [mark_jeronimus-gmail-] Code: <PRE>This will shift an array of values to the right by 4 bits, filling the leftmost nibble with zeroes. Example: Before: Temp3 = 12h Temp2 = 34h Temp1 = 56h Temp0 = 78h After: Temp3 = 01h Temp2 = 23h Temp1 = 45h Temp0 = 67h It can be extended to any length and shofting to the left works on the same principle. SWAPF TEMP0,W ANDLW 0x0F MOVWF TEMP0 SWAPF TEMP1,W MOVWF TEMP1 ANDLW 0xF0 IORWF TEMP0,F MOVLW 0x0F ANDWF TEMP1,F SWAPF TEMP2,W MOVWF TEMP2 ANDLW 0xF0 IORWF TEMP1,F MOVLW 0x0F ANDWF TEMP2,F SWAPF TEMP3,W MOVWF TEMP3 ANDLW 0xF0 IORWF TEMP2,F MOVLW 0x0F ANDWF TEMP2,F ...</PRE> ON 20081008@5:44:37 AM at page: http://www.piclist.com/techref/microchip/math/bit/index.htm#39729.2351041667 [mark_jeronimus-gmail-] Replied to post 39729.2351041667 by mark_jeronimus-gmail- |Insert 'hmm how do I add a page the right way?' at: '<!-- 39729.2351041667 EOR --><A style="color:#AF4040" TITLE="Click to login and reply" REL="nofollow" HREF="/techref/login/default.asp?req=/techref/update.asp%3Fact=reply%26url=/techref/microchip/math/bit/new200810.txt%26id=39729.2351041667">+</A>' <A TITLE="mark_jeronimus-gmail-" NAME="39729.2351041667" HREF="/techref/member/mark_jeronimus-gmail-/index.htm">mark_jeronimus-gmail-</A> shares this code: "<A NAME="mark_jeronimus-gmail-" HREF="/techref/microchip/math/bit/shift4.htm" TARGET="_top"> /techref/microchip/math/bit/shift4.htm</A> <PRE>Shift by 4 bits at a time</PRE>" ON 20081008@1:57:12 PM at page: http://www.piclist.com/techref/microchip/math/bit/index.htm#39729.2393171296 James Newton[JMN-EFP-786] removed post 39729.2393171296 |Delete '<A TITLE="mark_jeronimus-gmail-" NAME="39729.2393171296" HREF="/techref/member/mark_jeronimus-gmail-/index.htm">mark_jeronimus-gmail-</A> replies: <I>hmm how do I add a page the right way?</I><!-- 39729.2393171296 EOR --><A style="color:#AF4040" TITLE="Click to login and reply" REL="nofollow" HREF="/techref/login/default.asp?req=/techref/update.asp%3Fact=reply%26url=/techref/microchip/math/bit/new200810.txt%26id=39729.2393171296">+</A><P>' ON 20081009@6:20:34 AM at page: http://www.piclist.com/techref/microchip/math/bit/shift4.htm# [mark_jeronimus-gmail-] edited the page. Difference: http://www.piclist.com/techref/diff.asp?url=H:\techref\microchip\math\bit\shift4.htm&version=1
| file: /techref/microchip/math/bit/new200810.txt, 2KB, , updated: 2008/10/9 05:20, local time: 2008/11/21 10:46,
38.103.63.57:LOG IN
|
| ©2008 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? Please DO link to this page! Digg it! <A HREF="http://massmind.org/techref/microchip/math/bit/new200810.txt"> microchip math bit new200810</A> |
| Did you find what you needed? |
Welcome to massmind.org! |
|
.