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

Codification Binay to BCD

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



Joined: 26 Feb 2004
Posts: 3

View user's profile Send private message

Codification Binay to BCD
PostPosted: Fri Feb 27, 2004 12:07 pm     Reply with quote

Hello,
I am making a conversion binary to BCD in C, and I don't know how to allocate the value of the four bits less significants (0-3) of a 8 bits variable, to the four first bits of the port D of the PIC, only from 0 to 3. I don't want to modify the others bits of the port.
For example: my variable is centenas= 0000 0001 and I want the state of the port D is the following:
port D =xxxx0001,
Also say that I don't know the value of centenas because it depends of the program.

thanks
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Fri Feb 27, 2004 12:46 pm     Reply with quote

x=portD;
x&=0xF0;
x|=centenas;
portD=x;
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