Hello.

I'm continiuing to evaluate PBP pro, so I built a simple circuit with 16F682A, two leds and a button (tied to Vdd via 10k resistor and when pushed, connects the pin to gnd) leds are tied to rb0 and rb1 via 1k resistors.

The code is below:

Code:
LED    VAR  PORTB.0   
LED2    VAR PORTB.1
brep var byte

mainloop:
BUTTON PORTB.3,0,255,10,brep,1,secondled
   High LED       
   Pause 250      
     Low LED      
   Pause 250      
 
   Goto mainloop 
 
secondled:
    high LED2
    return  
   End
The code works almost as it should do, but with a nice twist. When launched, if I press the button for the short period, the 2nd lend comes on and 1st one continues to blink, as it should do. However, if I press the button for a bit longer time, or press it 2nd time, the 1st led stops flashing!

What is the reason?

Also, I don't like that button should be handled in the loop with all my delays. Say I have somewhere in the code statement: pause 2000. This means, that even if I press button, I have to wait 2 seconds for software to react for it? is there a workaround for that? For example, on ZX Spectrum, if any key was pressed, the pause command, regardless of it's parameters, was terminated and next step executed immediatelly. Is same feature available here?