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

problems with timer x on 18F452

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



Joined: 10 Aug 2007
Posts: 7

View user's profile Send private message

problems with timer x on 18F452
PostPosted: Fri Feb 08, 2008 5:30 pm     Reply with quote

hello,

we have a problem with timer.

I use 2 pics 18F452 and a FRAM from Ramtron FM24C512.
This components communicate with I2C in Multimaster Mode :

18F452 (1) (master) <--> FRAM <--> 18F452 (2) (master)

with a little program (just I2C), the Multimaster Mode function great.
No bus collision.
I can write in FRAM with pic (1) and with pic (2).
I can read in FRAM with pic (1)) and with pic (2).
And so i can receive data on pic (1) from pic (2) by the FRAM.
... etc...

But when i introduce 1 timer interrupt, I2C is stopped !
I can see pic (1) and pic (2) function, because i can see 2 flicker leds with timer...

So, Do you known any incompatibility between the I2C bus and the timer's interrupt ?

I have tested the interrupt's priority, but without result...

thanks for your idea...

(excuse me for my poor english...)
_________________
made by www.nopnop.fr
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 08, 2008 7:37 pm     Reply with quote

Modify your i2c routines to disable interrupts while inside those routines.
Do this on all your fram i2c access routines, and see if it fixes the problem.
Example:
Quote:
void write_fram(int16 address, int8 data)
{
disable_interrupts(GLOBAL);
i2c_start();
i2c_write(0xa0);
i2c_write(address >> 8);
i2c_write(address);
i2c_write(data);
i2c_stop();
enable_interrupts(GLOBAL);
}
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