I'm struggling for hours now.
I use the following code and added an LED Blink for debug purposes,
but only gets one blink and then it hangs (on the serin2).
I have also tried serin.
Using Pic16F877 and have 2 PIR Sensors,
one on SENSORPIN1 and one on SENSORPIN2.

Any ideas?

<code>


&nbsp;&nbsp;&nbsp;Include "Modedefs.bas"

&nbsp;&nbsp;&nbsp;DEFINE&nbsp;&nbsp;&nbsp;OSC 4 ' Set the Xtal frequency

&nbsp;&nbsp;&nbsp;N2400&nbsp;&nbsp;&nbsp;CON 16780
&nbsp;&nbsp;&nbsp;P0&nbsp;&nbsp;&nbsp;VAR PORTB.6
&nbsp;&nbsp;&nbsp;P1&nbsp;&nbsp;&nbsp;VAR PORTB.7
&nbsp;&nbsp;&nbsp;SENSORNUMBER&nbsp;&nbsp;&nbsp;CO N 0
&nbsp;&nbsp;&nbsp;SENSORPIN1&nbsp;&nbsp;&nbsp;V AR PORTB.4
&nbsp;&nbsp;&nbsp;SENSORPIN2&nbsp;&nbsp;&nbsp;V AR PORTB.5
&nbsp;&nbsp;&nbsp;LEDPIN&nbsp;&nbsp;&nbsp;VAR PORTD.1
&nbsp;&nbsp;&nbsp;SENSORSTATUS&nbsp;&nbsp;&nbsp;VA R BYTE
&nbsp;&nbsp;&nbsp;DATARECEIVED&nbsp;&nbsp;&nbsp;va r byte
&nbsp;&nbsp;&nbsp;CCP1CON = 0
&nbsp;&nbsp;&nbsp;ADCON1 = 7

Main:
&nbsp;&nbsp;&nbsp;OUTPUT LEDPIN
&nbsp;&nbsp;&nbsp;input SENSORPIN1
&nbsp;&nbsp;&nbsp;input SENSORPIN2
Loop:
&nbsp;&nbsp;&nbsp;IF (SENSORPIN1 = 1) OR (SENSORPIN2 = 1) THEN
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SENSORSTATU S = "1"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HIGH LEDPIN
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PAUSE 1000
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOW LEDPIN
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PAUSE 1000
&nbsp;&nbsp;&nbsp;ENDIF

&nbsp;&nbsp;&nbsp;OUTPUT P0
&nbsp;&nbsp;&nbsp;INPUT P1
&nbsp;&nbsp;&nbsp;LOW P0

&nbsp;&nbsp;&nbsp;' ============ LED BLINK FOR DEBUG PURPOSES =================
&nbsp;&nbsp;&nbsp;HIGH LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;LOW LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;' ================================================== =========

&nbsp;&nbsp;&nbsp;SERIN2 P1, N2400, 10, Loop,[wait("T"),DATARECEIVED]

&nbsp;&nbsp;&nbsp;' ============ LED BLINK FOR DEBUG PURPOSES =================
&nbsp;&nbsp;&nbsp;HIGH LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;LOW LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;' ================================================== =========

&nbsp;&nbsp;&nbsp;if (DATARECEIVED = SENSORNUMBER) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OUTPUT P1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SEROUT2 P1, N2400, ["R",SENSORSTATUS]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SENSORSTATU S = "0"
&nbsp;&nbsp;&nbsp;endif

&nbsp;&nbsp;&nbsp;' ============ LED BLINK FOR DEBUG PURPOSES =================
&nbsp;&nbsp;&nbsp;HIGH LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;LOW LEDPIN
&nbsp;&nbsp;&nbsp;PAUSE 100
&nbsp;&nbsp;&nbsp;' ================================================== =========

&nbsp;&nbsp;&nbsp;Goto Loop
end
</code>

Thank you!!
koossa