| ??? 02/04/09 21:02 Read: times |
#162072 - Updated, but errors on my part Responding to: ???'s previous message |
I know I'm doing something silly wrong, I can't put my figure on it. I like your suggestion, I thought this would follow that model, clearly it isn't. Still working on it, but the error (among multiple others) is at the end of this post due to a pointer error. Any thoughts where I'm going wrong?
I2C.C file
unsigned char i2c_transmit(unsigned char address, *transmit_bytes, uchar num_bytes_send);
{
//extern unsigned char byte1, byte2;
// if already busy then return current status
if (i2cstatus & I2C_BUSY) return i2cstatus;
// now we are busy performing a transfer
i2cstatus = I2C_BUSYTX;
// store slave address + W for use in ISR
slaveaddress = address << 1;
// transmit start condition
STA = 1;
// transmission started
return I2C_OK;
}
=========================================================================
Defined in i2c.h file
extern unsigned char i2c_transmit(unsigned char address, *transmit_bytes[], uchar MAX_NUMBYTE_TX[]);
=========================================================================
Defined in IO.c file
uchar MAX_NUMBYTE_TX[] = {7};
=========================================================================
Defined in I/O.c
unsigned char transmit_bytes[] = {0,0,0,0,0,0,0};//Holds I2C data bytes
//only
//Not address
extern unsigned char MAX_NUMBYTE_TX[];
=========================================================================
called from main.c
MAX_NUMBYTE_TX[0] = 0; //Transmit 1 bytes of DATA ONLY on I2C
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0x03); // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY); // wait until complete
MAX_NUMBYTE_TX[0] = 1;
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0x03, 0x04); // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY); // wait until complete
MAX_NUMBYTE_TX[0] = 2;
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0xfe, 0x04, 0x05); // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY); // wait until complete
Getting error: I2C.H(25): error C141: syntax error near '*' for > extern unsigned char i2c_transmit(unsigned char address, *transmit_bytes[], uchar MAX_NUMBYTE_TX[]); |
| Topic | Author | Date |
| dynamic parameters in an I2C definition possible? | 01/01/70 00:00 | |
| how about | 01/01/70 00:00 | |
| trans_byte buffer? | 01/01/70 00:00 | |
| something like: | 01/01/70 00:00 | |
| Updated, but errors on my part | 01/01/70 00:00 | |
| This | 01/01/70 00:00 | |
| I must be stuck on stupid | 01/01/70 00:00 | |
| I Think it is this | 01/01/70 00:00 | |
| Array of pointers to characters | 01/01/70 00:00 | |
| Try this code | 01/01/70 00:00 | |
| Works great!...One question though | 01/01/70 00:00 | |
| The warning is real | 01/01/70 00:00 | |
| Not exactly as I coded | 01/01/70 00:00 | |
Update......Problem solved | 01/01/70 00:00 |



