Silicon Laboratories Stepper Machine Manual do Utilizador Página 34

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 40
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 33
AN428
34 Rev. 0.6
//
INTERRUPT(Timer2_ISR, INTERRUPT_TIMER2)
{
SMB0CF &= ~0x80; // Disable SMBus
SMB0CF |= 0x80; // Re-enable SMBus
TF2H = 0; // Clear Timer2 interrupt-pending flag
SMB_BUSY = 0; // Free bus
}
//-----------------------------------------------------------------------------
// Support Functions
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// I2C_ByteWrite
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters :
// 1) unsigned char addr - address to write in the device via I2C
// range is full range of character: 0 to 255
//
// 2) unsigned char dat - data to write to the address <addr> in the device
// range is full range of character: 0 to 255
//
// This function writes the value in <dat> to location <addr> in the device
// then polls the device until the write is complete.
//
void I2C_ByteWrite (U8 addr, U8 dat)
{
while (SMB_BUSY); // Wait for SMBus to be free.
SMB_BUSY = 1; // Claim SMBus (set to busy)
// Set SMBus ISR parameters
TARGET = SLAVE_ADDR << 1; // Set target slave address
Vista de página 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 40

Comentários a estes Manuais

Sem comentários