200 likes | 390 Views
APPLICATION OVER I2C. Kıvanç ÖZBEK 504031549. What is I2C?. 2-wired communication interface Communication protocol used in small areas Defined in 1980’s by Philiphs Bidirectional data transmission 7 bit slave address Acknowledgement after each byte. I2C Properties.
E N D
APPLICATION OVER I2C Kıvanç ÖZBEK 504031549
What is I2C? • 2-wired communication interface • Communication protocol used in small areas • Defined in 1980’s by Philiphs • Bidirectional data transmission • 7 bit slave address • Acknowledgement after each byte
I2C Properties • Random selection procedure • Transmission capacity up to 400 KHz • Line length up to 4 meters • Line capacitance up to 400 pF • Divice capacitance up to 10 pF
Roles • Master • Controling the clock signal • Defining the slave address • Defining the Start – Stop conditions • Slave • Sending ack after each byte • Controling the data line during read operations • Taking clock from the line
About the application • The term open-collector typically refers to a transistor output where the collector (output) of the transistor is not connected to a positive voltage. Since a transistor used in outputs is a saturated switch, the collector needs to be connected to a positive voltage to complete the transistor circuit. This positive voltage need not be any specific value as long as it is above the saturation of the transistor. Because of this, an open collector output can be connected to a range of voltages using a pullup resistor. This resistor is required for the output to function as it completes the transistor's circuit.
About the application wvalue=0x00; rvalue = outp(data,wvalue); delay(wait); wvalue=0x0f; rvalue=outp(control,wvalue);/*scl ve sda 1 yapildi*/ delay(wait); wvalue=0x80; rvalue = outp(data,wvalue);/*sda 0 yaparak start cond. olusturuldu*/
About the application wvalue=0x00; rvalue=outp(control,wvalue); /*scl 0 yapildi*/ delay(wait); wvalue=0x80; rvalue = outp(data,wvalue); /*sda 0 yapildi*/ delay(wait); wvalue=0x0f; rvalue=outp(control,wvalue); /*scl 1 yapildi*/ delay(wait); wvalue=0x00; rvalue = outp(data,wvalue); /*sda 1 yapilarak stop cond. olusturuldu*/ delay(wait);
About the application • check: • for(i;i<5;i++){ • rvalue=inportb(status); • rvalue<<=4; • delay(wait); • if(rvalue>127){ //scl 0 okundu • delay(wait); • rvalue=inportb(status); • rvalue<<=4; • if(rvalue<128){ //scl 1 okunursa hat mesgul • printf("Hat mesgul\n"); • i=0; • } • else{//isMain 0 ise sda 1 kalacaktir dolayisiyla ana master calisir • wvalue=isMain; • rvalue = outp(data,wvalue);//sda belirlenerek hat sahipligi olustu • delay(wait); • }
About the application • } • } • printf("Hat uygun kullanilabilir\n"); • wvalue=0x00; • rvalue=outp(control,wvalue); //scl 0 • delay(wait*2); • if(inportb(status) > 127){ //sda kontrol edildi • printf("Ana master calisacak\n"); • goto check; • }
Encountered Difficulties • No direct access to parallel port in XP • Because it is not allowed to use ports directly in windows xp, windows me is used. • No device to watch parallel port outputs • There were no hardware to watch the outputs so again parallel port is used to see what is written to the port. • Outer power supply • Game port pin 1(Vcc) and pin 4(Gnd) used.
Thank you for your interest Questions?