Searching \ for 'Parity generation ?' 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=parity+generation
Search entire site for: 'Parity generation ?'.

Truncated match.
PICList Thread
'Parity generation ?'
1998\05\09@235927 by James & Ili

flavicon
face
I remember a list discussion about parity generation a while back
but a search of the piclist archive doesn't turn it up. Could someone
share with me either the code, a pointer to the code or just the
theory
of the code please ??

Thanks in advance !!

James & Ili
Irving, TX. 75038

1998\05\10@001403 by David VanHorn

flavicon
face
>I remember a list discussion about parity generation a while back
>but a search of the piclist archive doesn't turn it up. Could someone
>share with me either the code, a pointer to the code or just the
>theory
>of the code please ??



Easy

The parity bit can be set in five ways.

Even, Odd, mark, space, or none.

None is easy, nonexistent, don't send it.
Mark and space are easy, transmit your data bits, then set the parity bit to
1 or 0, and send
Even results in always an even number of set bits in the byte: 00000000 P=0
00000001 P=1
Odd results in always an odd number of set bits in the byte:    00000000 P=1
00000001 P=0

That's all there is! :)

1998\05\10@001710 by Andrew Warren

face
flavicon
face
James & Ili <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I remember a list discussion about parity generation a while back
> but a search of the piclist archive doesn't turn it up. Could
> someone share with me either the code, a pointer to the code or just
> the theory of the code please ??

James & Ili:

Here are the two routines I posted; Scott Dattalo and others posted
routines, as well.

;
; Even parity generation in seven words / seven cycles.  Enter with
; data byte in register "X"; exits with even parity in bit 1 (and
; also bits 2, 3, 4, and 5) of "X".
;

PARITY_1:           ; X:              W:
                   ; ------------    ------------
   SWAPF   X,W     ;     ABCDEFGH        EFGHABCD
                   ;
   XORWF   X       ;     ABCDEFGH        EFGHABCD
                   ; xor EFGHABCD
                   ;
   RRF     X,W     ;                     -ABCDEFG
                   ;                 xor -EFGHABC
                   ;
   XORWF   X       ;     ABCDEFGH
                   ; xor EFGHABCD
                   ; xor -ABCDEFG
                   ; xor -EFGHABC
                   ;
   RRF     X,W     ;                     -ABCDEFG
                   ;                 xor -EFGHABC
                   ;                 xor --ABCDEF
                   ;                 xor --EFGHAB
                   ;
   RLF     X       ;     BCDEFGH-
                   ; xor FGHABCD-
                   ; xor ABCDEFG-
                   ; xor EFGHABC-
                   ;
   XORWF   X       ;     BCDEFGH-
                   ; xor FGHABCD-
                   ; xor ABCDEFG-
                   ; xor EFGHABC-
                   ; xor -ABCDEFG
                   ; xor -EFGHABC
                   ; xor --ABCDEF
                   ; xor --EFGHAB

;
; This one takes 19 words, but executes in either 5 or 7 cycles,
; INCLUDING the test-and-branch at the end of the routine.
;
; Oh... And this one doesn't affect X, either.
;

PARITY_2:

       SWAPF   X,W
       XORWF   X,W
       ANDLW   00001111B

       ADDWF   PC
       GOTO    ZERO
       GOTO    ONE
       GOTO    ONE
       GOTO    ZERO
       GOTO    ONE
       GOTO    ZERO
       GOTO    ZERO
       GOTO    ONE
       GOTO    ONE
       GOTO    ZERO
       GOTO    ZERO
       GOTO    ONE
       GOTO    ZERO
       GOTO    ONE
       GOTO    ONE

   ZERO:
       ....

   ONE:
       ....

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499 (personal)
=== http://www.netcom.com/~fastfwd (business)

1998\05\10@032440 by g.daniel.invent.design

flavicon
face
Grahams working code with parity:
*note: two macros used, I find it pretty deadly doing literal to file
shifts and file to file shifts with seperate code lines. macros are
"BTG" and "WMOVL"

(even parity)


;BASIC SETUP INFO:

BAUD_LOOPS      EQU     D'251'  ;1200 BAUD @ 5.58 MHz
ASCII           (SPARE DATA RAM VARIABLE FOR TX DATA)
DEL_A           (SPARE DATA RAM VARIABLE)
TASK_FLAGS      (SPARE DATA RAM VARIABLE)
#DEFINE         _TX_SCI PORTB,0  ;( REPLACE AS APPLICABLE )

;macro working variables:

MV1     EQU     0
MV2     EQU     0

macro definitions:
WMOVL   MACRO   MV1,MV2 ;       LITERAL TO FILE
       NOEXPAND
       MOVLW   MV1
       MOVWF   MV2
       ENDM

WMOVF   MACRO   MV1,MV2 ;       FILE TO FILE
       NOEXPAND
       MOVF    MV1,W
       MOVWF   MV2
       ENDM

BTG     MACRO   MV1,MV2 ;       BIT TOGGLE
       NOEXPAND
       MOVLW   1 << MV2
       XORWF   MV1,F
       ENDM

;======================================

;transmit code:

ASCII_TX_OUT
START_BIT
       CALL    ASYNC_H
TX_ASCII
       BCF     TASK_FLAGS,PARITY
       WMOVL   07,DEL_A        ; (7 BITS DATA, " MOVLW D'07' ",
                               ;               " MOVWF DEL_A " )
EACH_BIT
       BTFSC   ASCII,0
       GOTO    BZZ_HOT
       CALL    ASYNC_H
       GOTO    DUN_BZZ
BZZ_HOT
       CALL    ASYNC_L
       BTG     TASK_FLAGS,PARITY       ; (BTG IS MACRO,  " MOVLW 1 << PARITY ",
                                       ;                 " XORWF       MV1,F "
)
DUN_BZZ
       RRF     ASCII,F
       DECFSZ  DEL_A,F
       GOTO    EACH_BIT
SEND_PARITY
       BTFSC   TASK_FLAGS,PARITY
       GOTO    BZZ_HOTP
       CALL    ASYNC_H
       GOTO    DUN_BZZP
BZZ_HOTP
       CALL    ASYNC_L
DUN_BZZP
       CALL    ASYNC_L
       RETURN

;==========================================

ASYNC_L
       WMOVL   BAUD_LOOPS,CYCLES
       BSF     _TX_SCI
LTL_LOOP
       DECFSZ  CYCLES,F
       GOTO    LTL_LOOP
       RETURN

;==========================================

ASYNC_H
       WMOVL   BAUD_LOOPS,CYCLES
       BCF     _TX_SCI
HTL_LOOP
       DECFSZ  CYCLES,F
       GOTO    HTL_LOOP
       RETURN

;==========================================


James & Ili wrote:
{Quote hidden}

James & Ili wrote:
{Quote hidden}

1998\05\10@041709 by g.daniel.invent.design

flavicon
face
Apologies all,
previous message XTAL frequency wrong
trim
> BAUD_LOOPS      EQU     D'251'  ;1200 BAUD @ 5.58 MHz trim (transmit parity de
mo)
SHOULD READ:
BAUD_LOOPS      EQU     D'251'  ;1200 BAUD @ 3.58 MHz

ie a 3.58 MHz common colour burst crystal or resonator.

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