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

Accessing individual pins simultaneously ?

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



Joined: 12 Jun 2006
Posts: 19

View user's profile Send private message

Accessing individual pins simultaneously ?
PostPosted: Thu Oct 18, 2007 2:11 pm     Reply with quote

1.-How can I modify some spare pins in an a specific port in one instruction cycle, without modifying the other pins?, for example: how to output low the pins 1,2,4 of the Portb in one instruction without affecting the rest?
In assembly could be done by masking the bits, but how in C?
2.- Anybody knows why the PORT B cant drive a "74HC"

Thanks

Ysaac
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Oct 18, 2007 2:44 pm     Reply with quote

You can AND, OR or XOR the port data register. That will change multiple pins of a port in a single clock cycle.
Port B can certainly drive HC logic as well as any other port. Are both the HC and the PIC running from the same VCC?
_________________
The search for better is endless. Instead simply find very good and get the job done.
ysaacb



Joined: 12 Jun 2006
Posts: 19

View user's profile Send private message

PostPosted: Thu Oct 18, 2007 3:47 pm     Reply with quote

Quote:
You can AND, OR or XOR the port data register


how?

Quote:
Port B can certainly drive HC logic as well as any other port. Are both the HC and the PIC running from the same VCC?


I tryed to stream data to a 74HC595 using PB3 and doesn't work. but using PA4 does work
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri Oct 19, 2007 2:13 am     Reply with quote

Portb &= 0xF4; // Will set pins 1,2,4 to low with out altering the others

Current status 10010111
Mask 11110100
New status 10010100

Portb |= 0x0F; // Will set pins 1,2,3,4 and not change pins 5,6,7,8

Current status 10010111
Mask 00001111
New status 10011111
Guest








PostPosted: Fri Oct 19, 2007 6:45 am     Reply with quote

thanks Wayne

I supose the preniously it's necesary to define the adress of PORTB

i.e. #byte PORTB 0xF81 (for the PIC18F4620)

Rigth?
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