The Godfather talking
You think I am funny guy huh?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 06, 2016, 09:05:51 09:05


Login with username, password and session length


Pages: [1]
Print
Author Topic: PIC16F877A protocol I2C & SPI  (Read 6044 times)
0 Members and 1 Guest are viewing this topic.
pajaro
Guest
« on: July 13, 2008, 07:03:15 19:03 »

hello,

Somebody knows if, it is possible that we can use the protocol i2c and spi at the same time with oneself pic(PIC16F877A).

Devices to use with these two protocols

write/read a card SD or MMC --> Protocol SPI
ds1307, ISD51xx , ...           --> Protocol I2C


see you
Logged
mbandala
Senior Member
****
Offline Offline

Posts: 271

Thank You
-Given: 123
-Receive: 304



« Reply #1 on: July 13, 2008, 07:14:40 19:14 »

Sure it is possible! Just make sure that you close one module before opening the other. For instant use CloseSPI(); then configure the i2c module, then use OpenI2C(); and do the i2c communication. When you are done with the i2c module use CloseI2C(); then configure the SPI module, then use OpenSPI(); and do the SPI communication. When you are done use CloseSPI(); and loop the sequence from the beginning.
Logged

Feel free to press "thank you" if you think you have found something useful! -^
pajaro
Guest
« Reply #2 on: July 13, 2008, 08:43:45 20:43 »

hello

if I have a pic16F877A with a LCD 2x20, a ds1307 clock of real time which shows me the hour in it lines her first, but in it lines her 2 it shows me the frequency of a to receive FM from the radio,
this will produce retards with the lcd and the pic or with some of the devices?

see you
Logged
mbandala
Senior Member
****
Offline Offline

Posts: 271

Thank You
-Given: 123
-Receive: 304



« Reply #3 on: July 14, 2008, 03:54:14 15:54 »

I don't really know what your application is. However if you are using an LCD with the DS1307 and some other device then you can use the timings to your advantage. The LCD needs delays to allow the device to display characters correctly. So instead of wasting time between character writings you can do the communications with the external devices.

However, most LCDs require something like 1ms or more to allow for the next character to be written. 1 ms is way more that the times handled by i2c and spi devices because you can read/write to such devices in matter of few microseconds. In your application, you can read sec/min/hrs/day/date/month/year/&RAM in less time than you need to refresh the LCD (which presumably should be about once a second). So I don’t think you will have timing issues.
Logged

Feel free to press "thank you" if you think you have found something useful! -^
gem1144aaa
Junior Member
**
Offline Offline

Posts: 88

Thank You
-Given: 134
-Receive: 27


« Reply #4 on: November 17, 2008, 08:43:48 20:43 »

Sure it is possible! Just make sure that you close one module before opening the other. For instant use CloseSPI(); then configure the i2c module, then use OpenI2C(); and do the i2c communication. When you are done with the i2c module use CloseI2C(); then configure the SPI module, then use OpenSPI(); and do the SPI communication. When you are done use CloseSPI(); and loop the sequence from the beginning.

Hi mbandala


how can i close i2c or spi in Mikrobasic or mikroc?
Logged
Biggles
Junior Member
**
Offline Offline

Posts: 46

Thank You
-Given: 14
-Receive: 22



« Reply #5 on: November 18, 2008, 06:30:55 18:30 »

Somebody knows if, it is possible that we can use the protocol i2c and spi at the same time with oneself pic(PIC16F877A).

Yes. Both can appear to work together. SPI can be very fast! For SPI I recommend you do it in software, a little slower than hardware, but it will work first time!
Logged

Man who act in haste, repent at leisure.
gem1144aaa
Junior Member
**
Offline Offline

Posts: 88

Thank You
-Given: 134
-Receive: 27


« Reply #6 on: November 19, 2008, 11:47:40 11:47 »

hi

in mikrobasic they support both h/w i2c & softi2c

as they support h/w spi & softspi

but if you attend to use the spi with mmc/sd cards the softspi will not work for you & you should youse the h/w spi

so i i connected the ds1307 to the softi2c and the mmc to the h/w spi and it works fine


but my question is can i tie them both to the h/w i2c and h/w spi both at the same time?
Logged
caveman508
Junior Member
**
Offline Offline

Posts: 41

Thank You
-Given: 12
-Receive: 6

READ, REAd, REad, Read


« Reply #7 on: January 10, 2009, 07:35:53 07:35 »

hello,

Somebody knows if, it is possible that we can use the protocol i2c and spi at the same time with oneself pic(PIC16F877A).

Devices to use with these two protocols

write/read a card SD or MMC --> Protocol SPI
ds1307, ISD51xx , ...           --> Protocol I2C


see you

This is a job for multi-tasking.  Set up two tasks that when busy, give up and allow the other task to execute.

Caveman
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC