I have a DS1820 one wire digital temp. sensor, I designed a temperature measurement and control circuit and I used PIC16F877, I connected a led on PORTB7 and I wrote a pc program with C# 2005 Beta 2. In PC program I made a two buttons (turn led off and turn led on) . Led initial condititon is off. When I pressed turn on Led have to tuurn on. And also when I pressed turn off, led have to turn off. But there is a tricky problem. I used SERIN comand for receiving data, but when PBP code came to that command it waited a response from PC so for solving that problem I used a THREAD in PC program I send "0" every 2 seconds and when "0" sending to the pic, pic goes to the mainloop. When I send "1" , then PIC turns off the led, when I send "2" pic turns on the led. But When thread is starting, I mean when pc send "0" automatically and after that you pressed "1" or "2" PBP not respond this. Because when PC send "0" PBP program goes to mainloop and after a little time later if you press "1" or "2" PBP program maybe is not at line where SERIN command exist so both of the buttons wont work. I increased timeout but anyway this means wait at serin command for example 5 second then if user dis not pressed any button send "0" to PIC. This is not a exact solution. Exact solution is using INTERRUPT. But ı could not accomplish that. Please help me... How to use interrupt for this program??? I mean when interrupt comes to pic from usart ("1", or "2") then pic will leave current job and jump to the if value is "1" turn on the led or value is "2" turn off the led after this process resume previous position in the main loop. Thanks for your attention...