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

Sharing Hardware resource for UART and I2C at runtime

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



Joined: 09 Nov 2006
Posts: 2

View user's profile Send private message

Sharing Hardware resource for UART and I2C at runtime
PostPosted: Thu Nov 09, 2006 7:22 am     Reply with quote

Hi,

I am using PIC16F917 and only got one hardware resource for communication.

How can I select/change hardware resource for I2C or UART in runtime ?

I want to use hardware resource as I2C most time , but I need to also use UART hardware for a short period.Ofcourse they wont be working at the same time...The reason why I am not using software UART is ; I can not go higher baud rates upper than 9600bps with 8MHz internal clock...

I beleive selecting hardware for I2C or UART wont be a problem by investigating related registers , but I am seeking a way if compiler can do that.

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 09, 2006 12:38 pm     Reply with quote

There are bits in the control registers for the UART and i2c (SSP)
modules that can enable/disable the modules. You would have to set
the proper TRIS settings for the current module that's using the pins.
You would also need external circuits to disable the MAX232-type chip
or the i2c chip, as required, so the chip that is not being used doesn't
interfere with the one that is in use. (Some MAX232-type chips can
be bought which have an Enable pin on the chip).

It's easier just to move the i2c signals to some other free pins and
use software i2c. That's my recommendation.
free_will



Joined: 09 Nov 2006
Posts: 2

View user's profile Send private message

PostPosted: Thu Nov 09, 2006 1:35 pm     Reply with quote

Hi,

That's exacly what I am workin on now , software I2C. After thinking deeply ,it is obvious that I2C Software will have very less load on CPU if compared with software UARTand the advantage is Master creating its own clock , so no possibility to miss any data provided that interrupts are disabled...

About sharing resources , I see that it is a complicated procedure, considering interference , I can not see any disadvanatge using software I2C.

You have been very helpful.

Thank you!
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