CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

please explain me about parity bit in software serial port.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
a
Guest







please explain me about parity bit in software serial port.
PostPosted: Thu Dec 23, 2004 4:46 am     Reply with quote

because it is not work for me. i use software serial in board1 and board 2. board 1 send data to board2 . data is 0x15. but when i capture data from board2 data is 0x14 in sometime and 0x15 in the sometime. but i'm very confuse about parity bit is not check because i use parity bit is even in boat software uart . below is my configuration of my 2 board.

board1 is
===============================================
#include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)

#use rs232(baud=9600, float_high, ERRORS, parity=E,xmit=PIN_B0,rcv=PIN_B0,bits=8,force_sw)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#bit ninth_bit = RS232_ERRORS.7
#bit collision = RS232_ERRORS.6
#bit intf = 11.1

===========================================

board2

#include <16F876.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=3579545)

//#use rs232(baud=9600, ERRORS ,parity=E,xmit=PIN_B7,rcv=PIN_B7,bits=8)
#use rs232(baud=9600, float_high, ERRORS ,parity=E,xmit=PIN_B7,rcv=PIN_B7,bits=8,FORCE_SW)

#bit ninth_bit = RS232_ERRORS.7
#bit collision = RS232_ERRORS.6

=============================================

and question number 2 is
can i use 8 bits in one wire communication or not.
and why parity bit is not work for me when i check collision

i'm use version 3.207
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Dec 23, 2004 12:46 pm     Reply with quote

The software UART does no parity checking on reception, if this is important to you, you will have to write your own parity checking routine.
In order to get access to the parity bit you can change the rs232 settings from 8 bits/even parity to 9 bits/no parity, bit number 9 is then the parity bit.


Why do you want to use parity checking? Parity introduces an 12.5% data overhead and can only detect a limited set of errors. All new applications use CRC codes instead because this has lower data overhead and is much better in detecting errors.
Some CRC examples can be found in this thread. I especially like the fast 8-bit CRC routine supplied by dvdb.

A remark: I see you use the FLOAT_HIGH option which is supposed to be used with an open-collector output. Please note that PIN_B0 has a totem-pole output and this seems tricky to me in a one-wire bus setup. Why don't you use PORT_A4 which has an open drain output?
a
Guest







PostPosted: Fri Dec 24, 2004 2:46 am     Reply with quote

thank you " ckielstra " . You say i must write routine for check parity bit in software serial and change my config from 8 bit /even to 9 bit / no parity. but if i set follow it can i check bit by bit in #int_rb. because i must check parity bit follow standard of smartcard T=0. it is required by standard. parity must checked every byte and if data is error. receiver must send output_low between guard time( 2 stop bit) Sad
then i must write my software serial by my self. True Or false Crying or Very sad
Please advise me for my solution .
thank you very much.
a
Guest







PostPosted: Fri Dec 24, 2004 2:57 am     Reply with quote

Parity must checked every byte and if data is error. receiver must send output_low between guard time( 2 stop bit) and sender must know. data is error and retransmit old data byte.
Can i check data in pin_R7 by #int_rb if i'm not wrong. interrupt #int_rb will be checked every on change but if data serial is 00110011 #int_rb will do on first zero and can not detect second zero and it will do on first number one and can't detect second number one.
then i must check by other interrupt and set buad rate to 9600 yes or no. Crying or Very sad

i'm just use it compiler. sorry for my english.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group