Flashing LED... PK2Error0029

Status
Not open for further replies.

RobertD

New Member
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:
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

**broken link removed**
 
Last edited:
It works fine in my Oshonsoft simulator.

Add an origin and get rid of that surplus ',' after the TIMER2
 
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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…