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 support@ccsinfo.com

Help me about parity bit sourcecode

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 27, 2004 12:50 pm     Reply with quote

To fix that routine, you need to move "data" into the W register,
and then mask it down so that only bit 0 is valid. See the two
lines that I've added right above the "return" statement at the end.

Code:
int8 find_parity(int8 data)
{
#asm
swapf data, W
xorwf data, F
rrf   data, W
xorwf data, F
btfsc data, 2
incf  data, F
movf  data, W
andlw 1
movwf _return_
#endasm

 
a
Guest







PostPosted: Mon Dec 27, 2004 1:24 pm     Reply with quote

thank you again. MR.PCM programmer and "ckielstra"Very Happy it's work.
i will try your sourcecode and used it for my thesis. i hope u happy in this year and next year. May be. i want your help in the future. thank you very much. you are the light for me. Very Happy
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