Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB-Unable to enter debug mode...

Status
Not open for further replies.

RobertD

New Member
Hi folks, I'm trying to read the chip registers, I build the project, then load it, then I press run, I get a message that the target program has changed from last build...? or I get this message: Unable to enter debug mode.

I'm trying to run this table program:

Code:
	LIST	p=16F88
	include "P16F88.inc"
	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
	ERRORLEVEL 0, -302



	TB0	equ	0x20    

 	
		org	0x20

	dt, h'0',h'1',h'2',h'3',h'4',
	dt, h'5',h'6',h'7',h'8'
	return	
	
	
	org 0X00

	movlw	0x06
	addwf	PCL
  	call 	TB0

hang	goto 	hang
	end
 
Last edited:
try this
Code:
	LIST	p=16F88
	include "P16F88.inc"
	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
	ERRORLEVEL 0, -302



TB0	equ	0x20

       org     0x00
       goto    main

       org	0x20

       dt, h'0',h'1',h'2',h'3',h'4',
       dt, h'5',h'6',h'7',h'8'
       return


main
	movlw	0x06
	addwf	PCL
  	call 	TB0

hang	goto 	hang
	end
 
I'm trying to get the table to return the 6th value using this program. Really, all I'm trying to do is understand how the table program works. Watching the three registers, I see a 6 in W, but nothing in PCL, and nothing in VALUE being returned.

Code:
LIST	p=16F88
	include "P16F88.inc"
	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
	ERRORLEVEL 0, -302

TB0	equ	0x20
value	equ	0x30

       org     0x00
       goto    main

       org	0x20

       dt, h'0',h'1',h'2',h'3',h'4',
       dt, h'5',h'6',h'7',h'8'
       return


main
	movlw	0x06
  	call 	TB0
	addwf	PCL,f
	movwf	value

hang	goto 	hang
	end
 
I've modified your code so it works. I also changed the data in the table to make it more obvious that it does work:
Code:
LIST	p=16F88
	include "P16F88.inc"
	__config _CONFIG1, _WDT_OFF & _INTRC_IO & _MCLR_ON & _LVP_OFF
	ERRORLEVEL 0, -302


value	equ	0x30

       org     0x00
       goto    main

    	org	0x20
TB0	addwf PCL,f
	dt h'40',h'41',h'42',h'43',h'44'
        dt h'45',h'46',h'47',h'48'
       
main
	movlw	0x6
  	call 	TB0
	movwf	value

hang
	goto 	hang
	end

The code generated:
Code:
Line  Address  Opcode Disassembly              

     1   0000  282A    GOTO 0x2a                              
<snip!>                          
    33   0020  0782    ADDWF 0x2, F                           
    34   0021  3440    RETLW 0x40                             
    35   0022  3441    RETLW 0x41                             
    36   0023  3442    RETLW 0x42                             
    37   0024  3443    RETLW 0x43                             
    38   0025  3444    RETLW 0x44                             
    39   0026  3445    RETLW 0x45                             
    40   0027  3446    RETLW 0x46                             
    41   0028  3447    RETLW 0x47                             
    42   0029  3448    RETLW 0x48                             
    43   002A  3006    MOVLW 0x6                              
    44   002B  2020    CALL 0x20                              
    45   002C  00B0    MOVWF 0x30                             
    46   002D  282D    GOTO 0x2d
 
Last edited:
Thanks Kchriste, I wasn't too far from being there, but it could have been as far as the moon since I didn't know if it was program, programmer or hardware, or me. As usual, it was me being very green and making all the mistakes.

Yes Boomslang, I did get the AD to work with Bill's help, and thanks a lot guys, you have been most helpful. Now with the table working, I'll be able to patch the whole program together... I hope. :) I suppose I could have kept working on it a little longer and get it to work eventually, but I have a lazy bone somewhere...

Hey, it's my first program, and the first time I program a PIC I suppose it's a little ambitious a project, but I have to say it does make quite an introduction since it incorportates nearly all the features of the 16F88, AD, tables, eprom r/w. Now I have to make all the tables to work together, and then it's the eprom. After that, I'll patch it all together and hopefully it'll do what I want it to do.
 
Most people's first program just flashes an LED :)

I had to do that to test the pull ups on portb. :)

But I have to say it's not the first time I program, I have written some Fortran and some very basic Basic. And I have a good idea about what the movement of data entails. I downloaded Swordfish, I think it is a lot easier to program with Swordfish than with assembly, once the language is mastered. But I like assembly, it's very simple, and I can do what I want with it.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top