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

Two inputs to Portc

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







Two inputs to Portc
PostPosted: Thu Mar 06, 2003 6:25 am     Reply with quote

I have two inputs I need to send to PORTC. 1st input needs to go on 1st 4 bits and 2nd input needs to go next 4bits. How can I do that. Should I use output_portc(value) and send it twice or there is other way of doing this.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12421
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

Re: Two inputs to Portc
PostPosted: Thu Mar 06, 2003 12:06 pm     Reply with quote

Here is one such example:

data1 = 0x03;
data2 = 0x02;

temp = (data2<<4)&(data1&0x0f);
PORTC = temp;


:= I have two inputs I need to send to PORTC. 1st input needs to go on 1st 4 bits and 2nd input needs to go next 4bits. How can I do that. Should I use output_portc(value) and send it twice or there is other way of doing this.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12433
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Two inputs to Portc
PostPosted: Thu Mar 06, 2003 1:29 pm     Reply with quote

:= I have two inputs I need to send to PORTC. 1st input needs to go on 1st 4 bits and 2nd input needs to go next 4bits. How can I do that. Should I use output_portc(value) and send it twice or there is other way of doing this.
-----------------------------------------------------------

It seems like you're describing an LCD interface.
See the CCS example file, LCD.C, which shows how
to define several bits as a element of a structure.
Then you can write to those 4 bits with one line of code.
The LCD.C file is in this folder:
c:\Program Files\Picc\Drivers
___________________________
This message was ported from CCS's old forum
Original Post ID: 12439
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