Hi,
The I2C BoostC commands appear to be as follows :
void i2c_START(void) // Generates the I2C Bus Start Condition
void i2c_RESTART(void) // Generates the I2C Bus Restart Condition
void i2c_STOP(void) // Generates the I2C Bus Stop Condition
unsigned char i2c_WRITE(unsigned char i2c_data) // Generates the I2C Bus Write Condition
unsigned char i2c_READ(char ack_status) // Generates the I2C Bus Read Condition
void i2c_INIT(unsigned char i2c_divisor) // Generates the I2C Bus Initialization
these can presumably be used to generate a read and write along the lines of :
// Read from the External EEPROM
i2c_start();
i2c_write(HW_address); // send XEE i2c address
i2c_write(i2c_addr >> 8 ) ; // send XEE internal HIGH address
i2c_write((char) i2c_addr & 0x00ff); // send XEE internal LOW address
i2c_restart(); // send i2c_restart
// Write to the External EEPROM
i2c_start();
i2c_write(HW_address); // send XEE i2c address
i2c_write(i2c_addr >> 8 ) ; // send XEE internal HIGH address
i2c_write((char) i2c_addr & 0x00ff); // send XEE internal LOW address
However, after incorporating the command
#include <i2c_driver.h>
in the supplemantary code section of Flowcode I cannot get Flowcode to compile a C code icon containing any of these commands, e.g.
i2c_start();
in a C code icon is not recognised.
Please give me a starter in implementing the commands in Flowcode.
Thanks,
Mark
Using Boost-C I2C commands in Flowcode
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Hello Mark,
If you look at the start of the "i2c_driver.h" file, it says the following:
However, the linker failed when I tried to compile this code at 19.6608MHz - I had to change the clock frequency to 20MHz.
If you look at the start of the "i2c_driver.h" file, it says the following:
If you do add these to your "supplementary code" window before the #include statement, the code will compile.////////////////////////////////////////////////////////////////////////////
// The following three sections should be copied to the user's program:
// i2c master hardware / software mode definition
// i2c software implementation template arguments and variables
// i2c hardwareware implementation template arguments
////////////////////////////////////////////////////////////////////////////
However, the linker failed when I tried to compile this code at 19.6608MHz - I had to change the clock frequency to 20MHz.