Thank you frank......... I changed my software version and install v4.1.0.18. i have to make simple programming of interfacing EEPROM using I2C from RX71 to R1EX24016ASAS0A EEPROM IC. I made program like below; void main(void) { R_MAIN_UserInit(); /* Start user code. Do not edit comment generated here */ /* Initialize the debug LCD */ R_LCD_Init(); /* Displays the application name on the debug LCD */ R_LCD_Display(0, (uint8_t *)" RSK+RX71M "); R_SCI7_Start(); /* Enable I2C eeprom interface */ // R_RIIC2_Start(); while (1U) { double data; uint8_t sig[7]; uint8_t data1[10] = { 0x00u, 0x66u, 0x67u, 0x68, 0x69, 0x70, 0x71 }; char data_str[7]; if ( j 9) { // value = value1 * j; // R_IIC_EepromWrite(addr, value, no_bytes); //if (TRUE == R_IIC_EepromRead (E_address, (uint8_t *)&sig, sizeof(uint16_t))) //R_IIC_EepromWrite(addr, (uint8_t*)&data1[0] , sizeof(uint8_t) ); //R_IIC_EepromRead (E_address, (uint8_t *)&sig, sizeof(uint16_t)); if (EEPROM_write(data1[2])) { R_LCD_Display(7, (uint8_t *)" EEPROM_Write_OK"); } data = EEPROM_read(); LCD_Display_EPROM_Value( data ); j++; } } /* End user code. Do not edit comment generated here */ } /*********************************************************************************************************************** * Function Name: R_MAIN_UserInit * Description : This function adds user code before implementing main function. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_MAIN_UserInit(void) { /* Start user code. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ } /* Start user code for adding. Do not edit comment generated here */ static void LCD_Display_EPROM_Value (const uint8_t data ) { uint8_t i = 2; char data_str[20]; if (i 10) { //sprintf(data_str, " data: %u ", data); R_LCD_Display(i, (uint8_t *)data_str); i++; } else { R_LCD_Display(9, (uint8_t *)" FULL"); } } static uint8_t EEPROM_read () { double data; uint16_t sig; if (TRUE == R_IIC_EepromRead (E_address, (uint8_t *)&sig, sizeof(uint16_t))) { data = sig ; E_address++; } return data; } static uint8_t EEPROM_write( const uint8_t v ) { uint8_t store_ok = FALSE ; eeprom_record_t newrec; newrec.data = v; //sizeof(eeprom_record_t)sizeof(uint16_t) if( store_ok == R_IIC_EepromWrite(addr, (uint8_t *)&newrec, sizeof(eeprom_record_t) )) { store_ok = TRUE ; } return store_ok; } /* End user code. Do not edit comment generated here */ uint8_t R_IIC_EepromWrite (const uint16_t addr, uint8_t * const data, const uint16_t no_bytes) { /* requires buffer in static memory as write is done in interrupts */ static uint8_t iic_write_buf[MAX_WRITE_BYTES]; MD_STATUS ret; /* R1EX24016 addressing is achieved with a10-a8 in bits 3-1 of the device address */ /* the first byte is then address bits a7-a0*/ const uint16_t device_addr = (uint16_t)((EEPROM_DEVICE_ADDRESS | (uint8_t)((addr & 0x0f00u) 7u)) 1); /* form static write buffer than contains address and data */ if (no_bytes (MAX_WRITE_BYTES - sizeof(uint8_t))) { return FALSE; } iic_write_buf[0] = (uint8_t)(addr & 0x00ff); memcpy(&iic_write_buf[1], data, (uint32_t)no_bytes); /* Send write of address and data */ ret = R_RIIC2_Master_Send(device_addr, iic_write_buf, (uint16_t)(no_bytes + sizeof(uint8_t))); if (MD_OK != ret) { return FALSE; } /* Wait for transmission to complete with a 1 s timeout*/ if (FALSE == R_IIC2_MasterWaitTxComplete()) { return FALSE; } return TRUE; } uint8_t R_IIC_EepromRead (const uint16_t addr, uint8_t * const data, const uint16_t no_bytes) { MD_STATUS ret; /* R1EX24016 addressing is achieved with a10-a8 in bits 3-1 of the device address */ /* the first byte is then address bits a7-a0*/ const uint16_t device_addr = (uint16_t)((EEPROM_DEVICE_ADDRESS | (uint8_t)((addr & 0x0f00u) 7u)) 1); uint8_t low_addr = (uint8_t)(addr & 0x00ffu); /* Send write to configure memory to be read */ ret = R_RIIC2_Master_Send(device_addr, &low_addr, (uint16_t)sizeof(uint8_t)); if (MD_OK != ret) { return FALSE; } /* Wait for transmission to complete with a timeout*/ if (FALSE == R_IIC2_MasterWaitTxComplete()) { return FALSE; } ret = R_RIIC2_Master_Receive(device_addr, data, no_bytes); if (MD_OK != ret) { return FALSE; } /* Wait for reception to complete with a timeout*/ if (FALSE == R_IIC2_MasterWaitRxComplete()) { return FALSE; } return TRUE; } its build completely but i don't see result on LCD .......... So pease help me............to solve this problem...........
↧