doctek

  • Date JoinedJun 10, 2007
  • Total Views237,548
  • Featured %20%
  • Best Answers %0%

Orangeboard

vinstudy says: Oct 9, 2009. 12:15 AM
Hi. I m using USI_TWI driver for tiny2313. I want to set clock rate for 100KHz as my slave operates only at 100KHz. I have connected 8MHz external oscillator for tiny2313. Please help me to set the constants in drivers to generate clock @ 100KHz.

Thanks in advance.
doctek (author) in reply to vinstudyOct 11, 2009. 8:15 AM
Here's the code you need to make the 2313 divide it's clock by 8. This is described in the data sheet (page 30), so have a look there if you need more details. Using a 1MHz clock will result in the I2C bus running at 100KHz max.<br /><br />// Make clock go 4MHz <br /> CLKPR = 0x80; // Initiate write cycle for clock setting<br /> CLKPR = (1<<CLKPS1) | (1<<CLKPS0) ; // Divide Clock by 8<br /><br />Good Luck!<br /><br />
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!