Hi I want to simulate the I2C, and find this example
// Simulation of I2C Memory (Slave) MAP 0x010000, 0x01FFFF READ WRITE; signal void I2CMEMORY (void) { unsigned long adr; SADR = 0x54; adr = 0x010000; while (1) { wwatch (I2C_OUT); // Wait for data from Microcontroller while (I2C_OUT == 0x0100) { // START detected wwatch (I2C_OUT); // Wait for data from Microcontroller if (I2C_OUT > 0xFF) continue; if ((I2C_OUT >> 1) != SADR) continue; // test if Slave is addressed I2C_IN = 0xFF00; // ACK to Microcontroller if (I2C_OUT & 1) { // Slave Read while (1) { I2C_IN = _RBYTE(adr); // Read Byte from Memory adr++; // Increment Address wwatch (I2C_OUT); // Wait for ACK from Microcontroller if (I2C_OUT != 0xFF00) break; } } else { // Slave Write wwatch (I2C_OUT); // Wait for data from Microcontroller if (I2C_OUT > 0xFF) continue; adr = (I2C_OUT << 8) | 0x010000; // Set Memory Address High Byte I2C_IN = 0xFF00; // ACK to Microcontroller wwatch (I2C_OUT); // Wait for data from Microcontroller if (I2C_OUT > 0xFF) continue; adr = I2C_OUT | adr; // Set Memory Address Low Byte I2C_IN = 0xFF00; // ACK to Microcontroller while (1) { wwatch (I2C_OUT); // Wait for data from Microcontroller if (I2C_OUT > 0xFF) break; _WBYTE (adr, I2C_OUT); // Store Byte in Memory adr++; // Increment Address I2C_IN = 0xFF00; // ACK to Microcontroller } } } } }
But when I try to open this ini file I get this error
I2C_OUT ^ *** error 34: undefined identifier
I2C_out and I2C_in are the VTREGs, but here they could not be identified,What can i do now?
Are you sure that these VTREGs are correct for the particular processor that you're using?
I have tried with ">DIR VTREG" to see the VTREGs, but I2C_OUT or I2C_IN istn't inside.What can I do for I2C-Simulation?
I would check the device database on the Keil web page to make sure I2C is a supported simulated feature for the device you are using.
So that clearly explains why you get, "error 34: undefined identifier", doesn't it?
Are there similarly-named VTREGs like, say, I2C0_IN ?
Are you sure that I2C simulation is supported for your particular chip in the version of uVision that you have?
There istn't similarly-named VTREGs like I2C0.
I think I2C Simulation is supported for my chip. I use Keil uvision 3 (C166).
Have you checked?
I have checked, no similarly-named VTREGs like I2C.
No - I mean have you checked that I2C simulation is supposed to be supported for your chip?
I use the cpu ST10269. I haven't seen the I2c from description for this cpu in Options for target-Device . You mean that?