Your code has some issues
I can't verify your config settings as I no longer use that ancient old complier [you could at least update to 2.6c]Code:INCLUDE "h:\AllDigital.pbp" why ? ASM __CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L ENDASM OSCCON = $70 '$70 Internal oscillator is set to 16MHz $62 ' 8mhz--- '; Primary Clock is selected as system clock. OSCTUNE = $40 'HFINTOSC selected; PLL enabled; Factory calibrated frequency define OSC 64 ADCON0 = 0 why ? CM1CON0.7 = 0 why ? CM2CON0.7 = 0 why ? portb = 0 why ? latb = 0 why ? trisb = 0 is this really what you want ? '------------------------------------------ i var byte m var byte main_program: gosub blink 'call suroutin to blink a led GOTO main_program '============================================== blink: high portb '= $ff ' light the led for acertain amount of time this is not a legitimate use of HIGH for i = 0 to 100 'loop to maintain the led on FOR M = 0 TO 10 pause 1 NEXT NEXT low portb '= 0 'tuen off the led for certain amount of time this is not a legitimate use of LOW for i = 0 to 50 'loop to maintain the led off FOR M = 0 TO 10 pause 1 NEXT NEXT return '------------------------------------------- end
assuming your config and osc settings are workable then this code is tested an works for me ,
1k r in series with led, vdd 5v 4.7k pullup on mclr
Code:ASM __CONFIG _CONFIG1H, _FOSC_INTIO67_1H & _FCMEN_OFF_1H & _IESO_OFF_1H __CONFIG _CONFIG2H, _WDTEN_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _HFOFST_ON_3H & _MCLRE_ON_3H __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L ENDASM OSCCON = $70 '$70 Internal oscillator is set to 16MHz $62 ' 8mhz--- '; Primary Clock is selected as system clock. OSCTUNE = $40 'HFINTOSC selected; PLL enabled; Factory calibrated frequency define OSC 64 ANSELH = 0 trisb=%11111110 pause 2000 '------------------------------------------ i var byte m var byte main_program: gosub blink 'call subroutine to blink a led GOTO main_program '============================================== blink: LATB.0=1 ; light the led on portb.0 for a certain amount of time for i = 0 to 100 'loop to maintain the led on FOR M = 0 TO 10 pause 1 NEXT NEXT LATB.0=0 'turn off the led for certain amount of time for i = 0 to 50 'loop to maintain the led off FOR M = 0 TO 10 pause 1 NEXT NEXT return '------------------------------------------- end




Bookmarks