Hi Fish,

1. "pir" is very similar to "PIR1" which is register in the pic. I'd use a different name. It probably will work but i'd still pick a different name, just to be safe. I'll leave it alone for now.

2. You should declare your variables(pins) in a different manner.

3. You need to tell PBP that "pir" is an input. This could be done with the INPUT command.

4. It's probably also a good idea to set "cam" in a known state at startup. I'm guessing LOW.

5. The pause command can only accept values less than 65536. This means that you need to change pause 180000 to three pause 60000 instead.


Soooooo, with the changes made your program looks like this.

pir VAR GPIO.5
cam VAR GPIO.4

LOW cam
INPUT pir
Loop:
IF pir = 1 THEN
HIGH cam
PAUSE 1000
LOW cam
PAUSE 60000
PAUSE 60000
PAUSE 60000
ENDIF
GOTO Loop

I'd also recommend that you read the PBP manual(all of it) aleast a couple of times. You should also get familiar with you pic, read the datasheet ........ boring, i know but it's essential to know what resources you have to play with.

Cheers
/Ingvar