Darrel instant interrupts ... of course !!!
Hi, Nicolas
Use DT interrupts !!! ... it's not so difficult to use.
http://www.picbasic.co.uk/forum/showthread.php?t=3251
or a little trick I discovered :
insert " DEFINE INTHAND _INC" at the top of the program ... This places a "GOTO _INC" at location 00004 of the ASM program.
Now trim the interrupt register ( INTCON) to allow an " interrupt on PortB Change "
Place a correct preset value for W0 ... 0 is not a good value !!! ( in "decr:" nor !!! )
Place a "GOTO PULSE " before "inc"
Think to re-enable interrupts, placing " INTCON.7 = 1" just past "pulse" label
last, change "GOTO inc" to "GOTO pulse"
That should go at first...
Next step will be to use BUTTON instead of IF-THEN ... just to use the Auto-repeat feature ...
One more step ...
Have a look to Motorola ( yessss ... Freescale !!! ) "TPUPN xx" Application Notes ...
really Great !!!
http://www.bgsoflex.com/megasquirt.html
Alain