try this one
Code:INCLUDE "modedefs.bas" DEFINE LOADER_USED 1 DEFINE OSC 40 TRISB.0 = 1 TRISB.1 = 1 TRISB.2 = 1 TRISB.3 = 0 TRISC.6 = 0 PORTC.6 = 1 DelayLoop var word value var byte cw var portB.1 ccw var portB.2 MainLoopStatuLED var PORTB.3 INTCON = %10010000 'Enable all unmasked interrupt, Enable RB0/INT0 Interrupt on interrupt goto myint value=0 begin: ' Main Loop will blink a led every 0.5 secondes Toggle MainLoopStatusLED For delayloop = 1 to 50000 Pauseus 10 ' using Pauseus to avoid interrupt latency Next GOTO begin 'Interrupt handler Disable myint: value = value + cw - ccw serout2 portc.6, 16468, [dec3 value,13,10] INTCON.1 = 0 resume EnableAre you using a serial LCD???btw - is there a way to reset the printing using serout2 to the home position?
Try serout2 portc.6, 16468, [254,1,dec3 value,13,10]
Make sure your MCLR pin (PIN1) is attach to 5V with a pull-up resistor. 0.1uF + 47 uF can be installed to your supply line, close to the pic, to avoid nois and glitches.
try to remove all interrupt and test it in the main loop. Is it working without interrupt ?
If nothing is better, can you provide your schematic ??




Bookmarks