thanks for replying webbot!
actually master is CM02 from robot-electronics.com
http://www.robot-electronics.co.uk/htm/cm02tech.htmit only has instructions for the pc programming side
the workflow is like this
PC <--serial link via usb--> RF02 (((rf wireless link))) CM02<--I2C link-->AXON2
I can only send instruction to rf02 rest is with cm02
it says(reference
http://www.robot-electronics.co.uk/htm/cm02tech.htm)
Reading directly from any I2C deviceThis is similar to writing, except that you should add 1 to the device
address to make it an odd number. To read from an SRF08 at address 0xE0, you
would use 0xE1 as the address. (When the address goes out on the I2C bus,
its the 1 in the lowest bit position that indicates a read cycle is
happening). The maximum number of data bytes requested should not exceed 76
so as not to overflow the CM02's internal buffer. Here is an example of
reading the two byte bearing from the CMPS03 compass module:
I2C_CMD CPMS03 I2C address + Read bit CMPS03 bearing register
Number of bytes to read
0x55 0xC1 0x02 0x02
The CM02 will perform the read operation on the I2C bus and send two bytes
back to the PC - high byte first. The PC should wait for both bytes to be
returned (timing out after 500mS) before proceeding with the next
transaction.
---------------------------------
Now here is my pc side code
memset(command, 0, 50);
getWrireDataComm(command);
WriteFile(rfPort, &command, 10, &write, NULL);
ReadFile(axonPort, &command, 200, &read, NULL);
//axon prints that it recieved data through serial link
dumpbuf(command, "AXON says", read);
Sleep(1000);
memset(command, 0, 50);
getReadDataComm(command);
WriteFile(rfPort, &command, 4, &write, NULL);
memset(command, 0, 50);
//only garbage is read like 0xff and 0x01
//it should reply with 01, 02, 03 as bufferPut(data, 0x01);bufferPut(data, 0x02);bufferPut(data, 0x03); in axon txhandler
ReadFile(rfPort, &command, 10, &read, NULL);
dumpbuf(command, "RF says", read);
ReadFile(axonPort, &command, 200, &read, NULL);
//axon dosent print any thing as txhandler in axon was never called
//it should print "T" as rprintf("T\n");
dumpbuf(command, "AXON says", read);
void getWrireDataComm(BYTE command[])
{
command[0] = 0x55;
command[1] = 0xC0; // axon i2c address
command[2] = 0x00; // mode register
command[3] = 0x06; // data byte count
command[4] = 'H'; // data byte count
command[5] = 'A'; // data byte count
command[6] = 'S'; // data byte count
command[7] = 'S'; // data byte count
command[8] = 'A'; // data byte count
command[9] = 'N'; // data byte count
}
void getReadDataComm(BYTE command[])
{
command[0] = 0x55;
command[1] = 0xC1; // axon i2c address + 1 bit for read command
command[2] = 0x00; // mode register
command[3] = 0x03; // data bytes to read
}
Again thanks for the help webbot!
Regards,