Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

about I2C module in the DE2_TV demo

hi:

Now,I have being study the DE2_TV,which is one of the DE2 board demo,in I2C_controller module,I have some problem as follows:

//////////////////////////////////////////////////

wire I2C_SDAT=SDO?1'bz:0 ;

case (SD_COUNTER)

6'd0 : begin ACK1=0 ;ACK2=0 ;ACK3=0 ; END=0; SDO=1; SCLK=1;end

//start

6'd1 : begin SD=I2C_DATA;SDO=0;end

6'd2 : SCLK=0;

//SLAVE ADDR

6'd3 : SDO=SD[23];

6'd4 : SDO=SD[22];

6'd5 : SDO=SD[21];

6'd6 : SDO=SD[20];

6'd7 : SDO=SD[19];

6'd8 : SDO=SD[18];

6'd9 : SDO=SD[17];

6'd10 : SDO=SD[16];

6'd11 : SDO=1'b1;//ACK

///////////////////////////////////////////////////

in the code above: I cannot understand the code "SDO=SD",because if sd==1,I2C_SDAT will be "z",so how to output slave address?

thanks