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: > > 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 James & Ili 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 ?? > > Thanks in advance !! > > James & Ili > Irving, TX. 75038