Jump to content
I2Cdevlib Forums

Recommended Posts

I've got the AK8975_MPUEVB_heading sketch running on it's own.

 

When I add the code to my sketch it says it is running but returns

zeros for x,y,z. When the timer0 code is implemented.

 

//Timer0
  TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00); // 1010 0001
  //This set Timer0 into Mode 2/CTC Top = OCR0A
  TCCR0B = _BV(CS00); // 0000 0001
//Timer1
  TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM10);
  TCCR1B = _BV(CS10);
//Timer2
  TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
  TCCR2B = _BV(CS20);
 
//End timer setup
  //This activates Timer0
  TIMSK1 |= _BV(TOIE1);
 
Without the timer0 code everything works.
 
Clearly there is a connection between timer0 and I2C but I have no 
clue. Can anyone help?
 
 
 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...