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

MANCHESTER

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







MANCHESTER
PostPosted: Tue Sep 12, 2006 4:02 pm     Reply with quote

Hi

I m brazilian...
i don t speak a good english,,,


I need a code to receive the codifier of ci HT6P20. This ci use manchester...
Jannie Hamman



Joined: 16 Sep 2003
Posts: 6
Location: South Africa

View user's profile Send private message Send e-mail

Manchester code included
PostPosted: Thu Sep 21, 2006 9:55 am     Reply with quote

Here is working code:
Enjoy...


//Encode a byte to Manchester code
long enman(int this){
long man;
int i,lob,hib;
#bit tbit=this.0
lob=man;
for(i=0;i<4;i++){
shift_right(&lob,1,tbit);
shift_right(&lob,1,!tbit);
rotate_right(&this,1);
}
hib=hi(man);
for(i=0;i<4;i++){
shift_right(&hib,1,tbit);
shift_right(&hib,1,!tbit);
rotate_right(&this,1);
}
man=lob;
hi(man)=hib;
return(man);
}

//Decode Manchester code to original byte
int decman(long this){
int i,temp,out;
#bit tbit=temp.0
temp=this;
out=0;
for(i=0;i<4;i++){
shift_right(&out,1,tbit);
rotate_right(&temp,1);
rotate_right(&temp,1);
}
temp=hi(this);
for(i=0;i<4;i++){
shift_right(&out,1,tbit);
rotate_right(&temp,1);
rotate_right(&temp,1);
}
return(out);
}
_________________
Cheers,

Jannie
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