Silicon Laboratories Stepper Machine User Manual Page 23

  • Download
  • Add to my manuals
  • Print
  • Page
    / 40
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 22
AN428
Rev. 0.6 23
INTERRUPT_PROTO(SMBus_ISR, INTERRUPT_SMBUS0);
INTERRUPT_PROTO(Timer2_ISR, INTERRUPT_TIMER2);
void I2C_ByteWrite (U8 addr, U8 dat);
U8 I2C_ByteRead (U8 addr);
//-----------------------------------------------------------------------------
// MAIN Routine
//-----------------------------------------------------------------------------
void main (void){
U16 counter;
U8 curr_chip_val, clear_curr_val, clear_new_val, combined, reg;
Reg_Data curr;
U8 i; // Temporary counter variable used in for loops
PCA0MD &= ~0x40; // WDTE = 0 (disable watchdog timer)
OSCICN |= 0x03; // Configure internal oscillator for
// its maximum frequency (24.5 Mhz)
// If slave is holding SDA low because of an improper SMBus reset or error
while(!SDA)
{
// Provide clock pulses to allow the slave to advance out
// of its current state. This will allow it to release SDA.
XBR1 = 0x40; // Enable Crossbar
SCL = 0; // Drive the clock low
for(i = 0; i < 255; i++); // Hold the clock low
SCL = 1; // Release the clock
while(!SCL); // Wait for open-drain
// clock output to rise
for(i = 0; i < 10; i++); // Hold the clock high
XBR1 = 0x00; // Disable Crossbar
}
Port_Init (); // Initialize Crossbar and GPIO
Page view 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 39 40

Comments to this Manuals

No comments