//1)SET_INTERRUPT on MB_I2C_ADRESS requesting I2C_BYTES
Command[0] = SET_INTERRUPT;
Command[1] = MB_I2C_ADRESS;
Command[2] = I2C_BYTES;
if (TE_USB_FX2_SendCommand(USBDeviceList, Command, CmdLength, Reply, ReplyLength, 1000))
{
      cout << "Error" << endl;
      return -1;
}

//2)I2C_WRITE with MB_Command FX22MB_REG0_GETVERSION at byte 7
Command[0] = I2C_WRITE; //0xAD;//command I2C_WRITE
//Command[1] = MB_I2C_ADRESS;
//Command[2] = I2C_BYTES;
Command[3] = 0;
Command[4] = 0;
Command[5] = 0;
Command[6] = FX22MB_REG0_GETVERSION;//1; //get FPGA version
if (TE_USB_FX2_SendCommand(USBDeviceList, Command, CmdLength, Reply, ReplyLength, 1000))
{
     cout << "Error" << endl;
     return -1;
}

//3)GET_INTERRUPT
Command[0] = GET_INTERRUPT; //0xB1;//command GET_INTERRUPT
if (TE_USB_FX2_SendCommand(USBDeviceList, CardNo, cmd, cmd_len, reply, ReplyLength, 1000))
{
     if ((ReplyLength > 4) && (Reply[0] != 0))
     {
         //Console.WriteLine("INT# : {0}", Reply[0]);
         printf("Major version: %d \n", Reply[1]);
         printf("Minor version: %d \n", Reply[2]);
         printf("Release version: %d \n", Reply[3]);
         printf("Build version: %d \n", Reply[4]);

    }

}
  • No labels