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

How to use Port C

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



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

How to use Port C
PostPosted: Tue Dec 21, 2010 6:44 am     Reply with quote

Well,

I was working with MCP3208 with port B with a given example EX_AD12.C.
and it was working fine.
Now I tried with port C and the pins were replaced as follows:-

Pin B0-> Pin C0
Pin B1-> Pin C1
Pin B2-> Pin C2
and Pin B3-> Pin C3

I saw the datasheet of 18f452 wherein Pin C3 is said to be "RC3 can also be the synchronous serial clock for both SPI and I2C modes."

So does that mean C3 cannot be used for above mentioned circuit where the pins are replace???

Please reply.. Since the connections are made fine. but I'm not able to get any results.

Regards,
Sid
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 6:49 am     Reply with quote

and please also update me on how to use that pin C3 for i/o as well.
temtronic



Joined: 01 Jul 2010
Posts: 9162
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 6:57 am     Reply with quote

Yes and no...

Yes, you can use it for any I/O providing you disabled any internal peripheral that uses those pins. IE, disable the SPI/I2C 'stuff' if you want to use the pins for your LCD.

No, you can't use those pins IF you need to use them for SPI/I2C or whatever peripheral is 'attached' internally.

Also be aware that some pins may only be an INPUT (ie: GP3 of the 12F683), or are an open collector and will need a pullup resistor to work 'normal'.

Chips with internal OSC allow the user to 'reuse' the OSC1,OSC2 pins for I/O ,it's all in the setup.

Same goes for the _MCLR pin.The option exists to 'reuse' it as an INPUT, providing you select that mode in the FUSES.
Sid2286



Joined: 12 Aug 2010
Posts: 119

View user's profile Send private message

Connection details
PostPosted: Tue Dec 21, 2010 9:33 am     Reply with quote

Ok so unless and until I'm not using spi or i2c on the same pins I can use them as i/o, right? How do I disable the internal peripherals in ccs?
Ttelmah



Joined: 11 Mar 2010
Posts: 19328

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 10:09 am     Reply with quote

setup_spi(FALSE);

Best Wishes
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