here delay is 100ms and here also it took around 22seconds while on. geetansh wrote: >=20 > * > 0000: MOVLW 00 > 0001: MOVWF 0A > 0002: GOTO 019 > 0003: NOP > .................... // Source code file: ENDLESS.C=20 > .................... // Program function: Outputs variable count=20 > .................... #include <16F877A.h>=20 > .................... //////// Standard Header file for the PIC16F877A > device ////////////////=20 > .................... #device PIC16F877A=20 > .................... #list=20 > .................... =20 > .................... #use delay(clock=3D4000000)=20 > 0004: MOVLW 21 > 0005: MOVWF 04 > 0006: BCF 03.7 > 0007: MOVF 00,W > 0008: BTFSC 03.2 > 0009: GOTO 018 > 000A: MOVLW 01 > 000B: MOVWF 78 > 000C: CLRF 77 > 000D: DECFSZ 77,F > 000E: GOTO 00D > 000F: DECFSZ 78,F > 0010: GOTO 00C > 0011: MOVLW 4A > 0012: MOVWF 77 > 0013: DECFSZ 77,F > 0014: GOTO 013 > 0015: GOTO 016 > 0016: DECFSZ 00,F > 0017: GOTO 00A > 0018: RETURN > .................... void main()=20 > .................... =20 > .................... {=20 > 0019: CLRF 04 > 001A: BCF 03.7 > 001B: MOVLW 1F > 001C: ANDWF 03,F > 001D: BSF 03.5 > 001E: BSF 1F.0 > 001F: BSF 1F.1 > 0020: BSF 1F.2 > 0021: BCF 1F.3 > 0022: MOVLW 07 > 0023: MOVWF 1C > .................... while(1)=20 > .................... {=20 > .................... output_D(255);=20 > 0024: CLRF 08 > 0025: MOVLW FF > 0026: BCF 03.5 > 0027: MOVWF 08 > .................... delay_ms(100);=20 > 0028: MOVLW 64 > 0029: MOVWF 21 > 002A: CALL 004 > .................... output_D(0);=20 > 002B: BSF 03.5 > 002C: CLRF 08 > 002D: BCF 03.5 > 002E: CLRF 08 > .................... delay_ms(100);=20 > 002F: MOVLW 64 > 0030: MOVWF 21 > 0031: CALL 004 > .................... }=20 > 0032: BSF 03.5 > 0033: GOTO 024 > .................... }=20 > 0034: SLEEP >=20 > Configuration Fuses: > Word 1: 3F73 RC NOWDT PUT BROWNOUT NOLVP NOCPD NOWRT NODEBUG > NOPROTECT >=20 >=20 > this is d .lst file and no isr is here. so what i should do now? > i think there might be a problem in crystal oscillator,so if i use logic > analyzer of pickit 2 to know the frequency then problem will become much > clear. >=20 >=20 > Joe Wronski wrote: >>=20 >> First, you prove that a prescaler is there (which I doubt). You can=20 >> do that by getting CCS to output a lst file, and you analyze what the=20 >> compiler is doing before it gets to main(). You check to see if it is=20 >> doing anything with the clock to add a prescaler. You can also look at= =20 >> the disassembly to sanity check the values passed to the delay()=20 >> function (it's probably a macro). >> My guess is that a floating input pin RBx is causing interrupts and the= =20 >> isr is using up most of the processors time. So, you check to see if=20 >> the compiler put any isr vectors in there. And you prevent portb=20 >> interrupt on change on floating inputs by enabling portb pullups. >> If you have debugger capabilities, it is easier to do some of these=20 >> things by setting breakpoints, examining register contents, and single=20 >> stepping. Inserting dummy code in main() before the loop will let you= =20 >> set a breakpoint. The dummy code should do something that doesn't get=20 >> optimized out, like "unsigned char n; n =3D PORTB;" >> If it's the watchdog timer, or something else causing a reset, you will= =20 >> find that if you set a breakpoint before the loop, the breakpoint will=20 >> be hit more than once. You can also set a breakpoint at the isr vector= =20 >> to see if it is a robue interrupt. >>=20 >> Joe W >>=20 >>=20 >> On 6/18/2011 5:03 AM, geetansh wrote: >>> how can i remove that prescaler then? >>> >>> >>> >>> RussellMc wrote: >>>>> when the delay between on off was set >>>>> 10ms the leds took 2.3sec >>>> 2300 mS / 10 mS ~~~=3D 256 >>>> >>>> Delay MAY be out by a factor of 256, indicating that there is possibly >>>> a >>>> prescaler in the clock that is not being accounted for. >>>> >>>> >>>> Russell >>>> --=20 >>>> http://www.piclist.com PIC/SX FAQ& list archive >>>> View/change your membership options at >>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>> >>>> >>=20 >>=20 >> --=20 >> Joe Wronski >> Stillwater Embedded Engineering >> www.stillwatereng.net >>=20 >> --=20 >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >>=20 >>=20 >=20 >=20 --=20 View this message in context: http://old.nabble.com/--delay-time-problem%28= details-added%29-tp31874045p31875809.html Sent from the PIC - [PIC] mailing list archive at Nabble.com. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .