Searching \ for 'LFSR' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=lfsr
Search entire site for: 'LFSR'.

Truncated match.
PICList Thread
'LFSR'
1998\02\03@133846 by myke predko

flavicon
face
I'm going to copy the PICList on this because I think it might be of help to
other people.

>   HAVING TROUBLE UNDERSTANDING CRC, AS USED IN BOOK PG260
>9-15  WHERE IS THE CRC INITIATED?
>    ALSO IT REFERENCES DISPHEX & WRITEINS..........I DON'T SEE THESE
>SUBROUTINES IN THE BOOK.

What I was trying to do was publish the algorithm I came up with that was
much more efficient than what I originally came up with for the TV Remote
Controlled Robot.

When I was developing the code, I attached an LCD to the PIC to output what
was read during the CRC.

You can use the LCD Subroutines "LCDCHAR" (with the additions below) for
"DispHex" and "LCDINS" for "WriteINS".  Note that to setup the LCD, you have
to run "LCDInit" First.

To output a Hex Value, I use the code:

 movwf  Temp                   ;  Save the Byte to Output
 swapf  Temp, w                ;  Get the High Nybble First
 andlw  0x00F                  ;  Isolate it as the bottom four bits
 movwf  Temp2                  ;  Save the High Nybble for Later
 addlw  6                      ;  Is the Nybble "A" - "F"?
 movlw  '0'                    ;   Assume it's not
 btfsc  STATUS, DC             ;  If it is, then Digit Carry Flag will be Set
  movlw 'A' - 10               ;   And it is "A" - "F"
 addwf  Temp2, w               ;  Get the Correct Offset
 call   LCDCHAR                ;  Output the High Nybble

 movf   Temp, w                ;  Now Output the Low Nybble
 andlw  0x00F                  ;   The following code should be pretty familiar
 movwf  Temp2
 addlw  6
 movlw  '0'
 btfsc  STATUS, DC
  movlw 'A' - 10
 addwf  Temp2, w
 call   LCDCHAR

Just out of curiosity, does anybody have a better routine to convert a byte
into two ASCII hex representative bytes?

>    I WANTED TO WRITE RESULTS TO EEPROM.............TO READ LATER
>THOUGH I FOUND HOW TO DO THIS ; IT'S NOT MENTIONED IN THE BOOK

Code to write to 16C84 EEPROM is located in PROG32: Electronic Thermometer
with 7-segment LED displays, and PROG38: The MIC.  If you want to interface
a serial EEPROM, look at PROG41: Servo Controller.

Hopefully, you'll be able to find the information (and code snippets) that
you need in these projects.

>     THE TRAIN I'M READING IS SLOWER THAN IR REMOTES BUT LONGER
>                                               PLEASE HELP
>                                                 THANKS

Good luck, please let me know how you make out.

myke

"Programming and Customizing the PIC Microcontroller" is the January 1998
Electronics Book Club Main Selection.  See "http://www.myke.com".

1998\02\04@024345 by Caisson

flavicon
face
----------
> Van: myke predko <spam_OUTmykeTakeThisOuTspamPASSPORT.CA>
> Aan: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
> Onderwerp: LFSR
> Datum: dinsdag 3 februari 1998 19:35

-[ Cut ]-
>
> To output a Hex Value, I use the code:
>
>   movwf  Temp                   ;  Save the Byte to Output
>   swapf  Temp, w                ;  Get the High Nybble First
>   andlw  0x00F                  ;  Isolate it as the bottom four bits
>   movwf  Temp2                  ;  Save the High Nybble for Later
>   addlw  6                      ;  Is the Nybble "A" - "F"?
>   movlw  '0'                    ;   Assume it's not
>   btfsc  STATUS, DC             ;  If it is, then Digit Carry Flag will
be Set
>    movlw 'A' - 10               ;   And it is "A" - "F"
>   addwf  Temp2, w               ;  Get the Correct Offset
>   call   LCDCHAR                ;  Output the High Nybble
>
>   movf   Temp, w                ;  Now Output the Low Nybble
>   andlw  0x00F                  ;   The following code should be pretty
familiar
>   movwf  Temp2
>   addlw  6
>   movlw  '0'
>   btfsc  STATUS, DC
>    movlw 'A' - 10
>   addwf  Temp2, w
>   call   LCDCHAR
>
> Just out of curiosity, does anybody have a better routine to convert a
byte
> into two ASCII hex representative bytes?

Try this :

;----------------------------
;       W - Number to display

LCD_HexOut:     movwf   LCDChrIdx
               swapf   LCDChrIdx,W
               call    LCD_NibOut
               movf    LCDChrIdx,W
LCD_NibOut:     andlw   0x0f
               addlw   -0x0a
               skpnc
               addlw   0x07
LCD_NibOut1     addlw   0x3a
               goto    LCD_DtaW

;----------------------------

As you can see, this routine was ment do display a number on a LC-Display,
but anything goes ...

> myke
>
> "Programming and Customizing the PIC Microcontroller" is the January 1998
> Electronics Book Club Main Selection.  See "http://www.myke.com".

Rudy Wieser

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...