In the code , I found that the signal sda_o is always set to '0'. WHY? The signal sda_oen is an enable signal ,but it is set to be equal to 'din'; In my opinion , the 'din' should be set to zhe 'sda_o'. Why do the code be written in the example?
No, it's correct as is. Read up on how the I2C bus works.