> PICers - I have this code for a 16F84 that _should_ be pretty straightforward. It loops around, looks for a bandit on RA4 (connected to IR detector) fires camera if bandit is found. Trouble is the program freezes when it it bcf/bsf's PORTB. > Does it in ANIMATE on MPLAB (5.40) and also locks up when transferred to an actual PIC on breadboad :( These symptoms don't make sense. PICs don't just "freeze up" unless the clock is stopped. You can see the symptom in the simulator, so it should be easy to chase down from there. What happens when you single step over the offending lines? MPLAB will only show you source code lines that contain pure instruction as apposed to macros. Single step or animate (I'm not familiar with animate, never used it) with the focus on the program memory window, not the source windows. > bsf POWER ;Camera power is OFF. Active LOW > bcf flags,CAM ;Flag that power is OFF > check btfss flags,HUNT ;Still in hunt mode? > goto shutdown ;No - then quit > call watch ;Yes - look for a bandit > btfss flags,BANDIT ;Is a bandit present? > goto check ;No - keep checkin' > loop01 bcf POWER ;Yes - power up the camera. Active LOW > bsf flags,CAM ;Flag that power is ON > CAMWAIT ;MACRO - Let the camera stabilise ~5 secs > call watch ;Look for bandit again > btfss flags,BANDIT ;Still there? > goto check-2 ;No - go back to to checkin' Don't do this! This is a bug waiting to happen because sooner or later you will change something around CHECK, and this goto will break. There is absolutely no evidence by CHECK that other code assumes it can jump to CHECK-2 for a known action. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu