Even Parity


Closed Thread
Results 1 to 3 of 3

Thread: Even Parity

  1. #1

    Default Even Parity

    I am trying to do 8 data bits with even parity, if i use the program below it works fine when i work with 7 data bits and even parity but seems to fail as soon as i go to 8 bits with parity, any suggestions

    CMCON = %00000111 ;Disable Comparator module's
    OPTION_REG = %11010111 ;Set PIC options
    INTCON = 0 ;Disable interrupts
    TRISB = %00000010 ;RB1(RX) as input, others to Output
    TRISA = 255 ;SET PORTA AS INPUTS

    DEFINE OSC 8 ; set oscilator speed to 8mHz
    DEFINE HSER_RCSTA 90h ; Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ; Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 12 ; 9600 Baud @ 8MHz, 0.16%
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DEFINE HSER_BITS 9
    DEFINE HSER_EVEN 1

    PORTB.4 = 1
    DATAIN VAR BYTE[8]
    loop
    HSERIN [str DATAIN\8]
    HSEROUT [str DATAIN\8]
    goto looP
    END

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Hi Andre,

    I think it's a conflict with the DEFINE's.

    For 9bit reception, PBP needs to set a bit in RCSTA and TXSTA, but you've already specified what those values should be, so it can't.
    You could change the values of the 2 defines, But why. It's easier to let PBP figure things out.

    Try it like this ...
    Code:
    DEFINE OSC 8 ; set oscilator speed to 8mHz 
    DEFINE HSER_BAUD  9600
    DEFINE HSER_BITS 9
    DEFINE HSER_EVEN 1
    DEFINE HSER_CLROERR 1 ; Clear overflow automatically
    DT

  3. #3

    Smile parity

    Thank you it works fine

Similar Threads

  1. Using parity
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th February 2010, 13:03
  2. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 22:55
  3. SEROUT or HSEROUT "ODD" parity
    By RFsolution in forum Serial
    Replies: 7
    Last Post: - 9th December 2006, 11:34
  4. Parity Modes
    By Sphere in forum Serial
    Replies: 4
    Last Post: - 29th April 2006, 11:12
  5. Debug with parity?
    By cmolson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd December 2005, 01:23

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts