+ Reply to Thread
Results 1 to 4 of 4

Thread: Flashing LED... PK2Error0029

  1. #1
    RobertD Good RobertD Good
    Join Date
    May 2008
    Location
    Brampton Ontario
    Posts
    216

    Default Flashing LED... PK2Error0029

    I've been getting this error code whenever I run the program to flash the LED. I can't find the error code for what it means. I'm running the code that worked earlier, does anyone have any ideas...?


    Running Target
    PK2Error0029: Failed PICkit 2 operation: Halt
    PICkit 2 Ready

    Code:
    	LIST	p=16F88
    	include "P16F88.inc"
    	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
    
    	cblock	0x20
    ;variables go here
    d1
    d2
    d3
    	endc
    
    	org	0x0000		;start of program
    init
    	bsf	STATUS,RP0	;bank 1
    	movlw	0x72		;8MHz internal osc
    	movwf	OSCCON
    	movlw	0x07		;turn comparators off
    	movwf	CMCON
    	clrf	ANSEL		;all pins digital
    	movlw	0x00		;all pins outputs
    	movwf	TRISA ;& 0x7f
    	movwf	TRISB
    	bcf	STATUS,RP0	;select bank 0
    
    main	bsf	PORTA,1
    	call	delay
    	bcf	PORTA,1
    	call	delay
    	goto	main
    
    delay	movlw	0x15
    	movwf	d1
    	movlw	0x74
    	movwf	d2
    	movlw	0x02
    	movwf	d3
    delay_0	decfsz	d1,f
    	goto	dd2
    	decfsz	d2,f
    dd2	goto	dd3
    	decfsz	d3,f
    dd3	goto	delay_0
    	return
    
    	end
    
    Last edited by RobertD; 26th September 2008 at 10:23 PM.


  2. #2
    RobertD Good RobertD Good
    Join Date
    May 2008
    Location
    Brampton Ontario
    Posts
    216

    Default

    I changed the code, but still doesn't flash.
    I'm now using ICSP set up coming out of Junebug much like FUTZ has, and MPLAB does read the chip, so that's definitely getting closer to the action. I'm using this set up without the DIP switch.

    Code:
    		LIST	p=16F88
    	include "P16F88.inc"
    	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
    
    	cblock	0x20
    	TIMER1, TIMER2, 
    	endc
    	
    
    	banksel	TRISA	
    	movlw	0x42		
    	movwf	OSCCON
    	movlw	0x07		;turn comparators off
    	movwf	CMCON
    	clrf	ANSEL		;all pins digital
    	movlw	0x00		;all pins outputs
    	movwf	TRISA 		
    	banksel	PORTA
    	clrf	PORTA
    	goto	main
    
    
    delay
    	movlw   D'100'          
       	movwf   TIMER1          
                   
    delay2
    	movlw	D'200'			
    	movwf	TIMER2
    	decfsz  TIMER2,F        
    	goto    $-1             
                   
    	decfsz	TIMER1,F		
    	goto	delay2				
    	return			
    
    main
    	bsf		PORTA,7
    	call	delay
    	bcf		PORTA,7
    	call	delay
    	goto	main
    
    
    	end
    
    Last edited by RobertD; 27th September 2008 at 01:31 PM.

  3. #3
    ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent
    Join Date
    Jan 2007
    Location
    Hampshire. England.
    Posts
    10,810
    Blog Entries
    13

    Default

    It works fine in my Oshonsoft simulator.

    Add an origin and get rid of that surplus ',' after the TIMER2
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/

  4. #4
    RobertD Good RobertD Good
    Join Date
    May 2008
    Location
    Brampton Ontario
    Posts
    216

    Default

    Works fine on my sim too, just doesn't work on the chip when I load it. I'll add the org 0x000 at the beginning and see if that makes a difference.

    The chip flashes once or twice then hangs, either on or off, when I run from MPLAB.

+ Reply to Thread

Similar Threads

  1. Flashing an LED problem...
    By RobertD in forum Micro Controllers
    Replies: 23
    Latest: 30th June 2008, 10:51 AM
  2. flashing LED,s
    By mick the builder in forum Electronic Projects Design/Ideas/Reviews
    Replies: 7
    Latest: 15th December 2006, 08:18 PM
  3. low current flashing LED
    By joecool85 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 51
    Latest: 21st March 2006, 01:44 PM
  4. Adjustable 12v Flashing
    By ThirtyTwo in forum General Electronics Chat
    Replies: 7
    Latest: 29th August 2005, 01:35 AM
  5. flashing LED
    By 1997 GA16DE in forum General Electronics Chat
    Replies: 11
    Latest: 29th February 2004, 05:52 PM

Tags for this Thread