This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debug

Hi
I want to simulate the I2C, and find this example

// Simulation of I2C Memory (Slave)

MAP V:0,V:0xFFFF READ WRITE                  // Map User 64kB Memory region

DEFINE int SADR                              // Slave Address

signal void I2CMEMORY (void) {
  unsigned long adr;

  adr = V:0;
  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) | V:0;          // 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
        }
      }
    }
  }
}


SADR = 0x54  // Slave Address
I2CMemory()  // Starting signal function
But when I try to open this ini file I get
this error


// Simulation of I2C Memory (Slave)

MAP V:0,V:0xFFFF READ WRITE // Map User 64kB Memory region
____^
*** error 34: undefined identifier

Whera can i get more information about MAP?

0