
AN428
Rev. 0.6 35
SMB_RW = WRITE; // Mark next transfer as a write
SMB_SENDWORDADDR = 1; // Send Word Address after Slave Address
SMB_RANDOMREAD = 0; // Do not send a START signal after
// the word address
SMB_ACKPOLL = 1; // Enable Acknowledge Polling (The ISR
// will automatically restart the
// transfer if the slave does not
// acknoledge its address.
// Specify the Outgoing Data
WORD_ADDR = addr; // Set the target address in the
// device's internal memory space
SMB_SINGLEBYTE_OUT = dat; // Store <dat> (local variable) in a
// global variable so the ISR can read
// it after this function exits
// The outgoing data pointer points to the <dat> variable
pSMB_DATA_OUT = &SMB_SINGLEBYTE_OUT;
SMB_DATA_LEN = 1; // Specify to ISR that the next transfer
// will contain one data byte
// Initiate SMBus Transfer
STA = 1;
}
//-----------------------------------------------------------------------------
// I2C_ByteRead
//-----------------------------------------------------------------------------
//
// Return Value :
// 1) unsigned char data - data read from address <addr> in the device
// range is full range of character: 0 to 255
//
Comentários a estes Manuais