View previous topic :: View next topic |
Author |
Message |
Sid2286
Joined: 12 Aug 2010 Posts: 119
|
How to use Port C |
Posted: Tue Dec 21, 2010 6:44 am |
|
|
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
|
|
Posted: Tue Dec 21, 2010 6:49 am |
|
|
and please also update me on how to use that pin C3 for i/o as well. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Tue Dec 21, 2010 6:57 am |
|
|
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
|
Connection details |
Posted: Tue Dec 21, 2010 9:33 am |
|
|
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: 19505
|
|
Posted: Tue Dec 21, 2010 10:09 am |
|
|
setup_spi(FALSE);
Best Wishes |
|
|
|