Hello,
I am not sure which HCS08 derivative and which I2C component you use for your application but the slave address of the I2C device in the slave mode must be set before the I2C device is enabled, see the proper initialization sequence in a HCS08 reference manual:
Module Initialization (Slave)
1. Write: Control Register 2
• to enable or disable general call
• to select 10-bit or 7-bit addressing mode
2. Write: Address Register 1 to set the slave address
3. Write: Control Register 1 to enable the I2C module and interrupts
4. Initialize RAM variables (IICEN = 1 and IICIE = 1) for transmit data
5. Initialize RAM variables used to achieve the routine shown in the following figure
Whenever you need to change the slave address you should reinitialize the device. If you change the slave address when I2C device is enabled the behaviour is undefined.
So you need to rewrite the source code generated by the PEx component (you must select Code Generation - Don't Write Generated Component Modules in the pop-up menu of the I2C component and then you can modify the generated code). You can write own function for re-initialization of the I2C.
Best Regards,
Marek Neuzil