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.

inchworm+again

Status
Not open for further replies.

portroyal

New Member
Hi all. I've have this inchworm+ for months now and i still can no get the debugger working. i brought it for the debug ability and not for the programming as i already have one. i continue to get the same error 061 that others have had. i have tried all the thing on this thread but still no luck. i have also soldered wires to the pins on the solder side of the boards to eliminate the idc sockets and cable but still have the same problem. everything work fine in the program mode but not in debug mode. my target board is the same as the poster but has 20meg Crystal on vero board. the pic is pic 16f877a. I'm using mplab 8.01, have had 7.50 and up. in the project I'm using the 16f877ai.lkr linker script. my crystal is working fine, I've had the scope on it and it is a nice sin wave. the code is a blinking led. it is a long code for a blinking led but it is for the perpose of getting used to using mplab and its language. this is the code. i think it maybe the config word that's the problem. i don't know. help
 

Attachments

  • testled.asm
    970 bytes · Views: 127
  • delaytest.asm
    2.3 KB · Views: 114
Unless you're building modular code you don't need the linker.
With MPLAB 8.01 you should use the RELEASE or DEBUG mode at the top of MPLAB (it'll warn you anyway)
Also don't use the _debug_on directive as MPLAB will set it based on the Release / Debug mode when you build all.
PLUS the target PIC may not enter debug when the _PWRTE_ON is used, try _PWRTE_OFF instead.

You also need to learn to write modular code properly; that means no absolute references and you should be very adept with MPASM before doing that. I've looked at your code and they're are some oddities that should be addressed.
Notes:
This is good
Code:
#include <p16F877A.inc>
This is not, that include file already defines these SFRs
Code:
status         equ    0x03    
option_reg       equ      0x81
portb           equ      0x06
trisb           equ      0x86
Also not good practice as "STATUS, RP0" is the correct way to write it
Code:
        bcf        status,    5     ;selecting bank0
Nope not modular as it's absolute code
Code:
countram    equ 0x20        ;set counter to address to hex
count        equ countram+0
count1        equ countram+1
count2        equ countram+2
As the single stepping debugger can run one instruction at a time you can simulate without delays just to confirm your target PIC has entered debug.
So blinking an LED at 20MHz
 
blueroomelectronics said:
Unless you're building modular code you don't need the linker.
With MPLAB 8.01 you should use the RELEASE or DEBUG mode at the top of MPLAB (it'll warn you anyway)
Also don't use the _debug_on directive as MPLAB will set it based on the Release / Debug mode when you build all.
PLUS the target PIC may not enter debug when the _PWRTE_ON is used, try _PWRTE_OFF instead.

You also need to learn to write modular code properly; that means no absolute references and you should be very adept with MPASM before doing that. I've looked at your code and they're are some oddities that should be addressed.
Notes:
This is good
Code:
#include <p16F877A.inc>
This is not, that include file already defines these SFRs
Code:
status         equ    0x03    
option_reg       equ      0x81
portb           equ      0x06
trisb           equ      0x86
Also not good practice as "STATUS, RP0" is the correct way to write it
Code:
        bcf        status,    5     ;selecting bank0
Nope not modular as it's absolute code
Code:
countram    equ 0x20        ;set counter to address to hex
count        equ countram+0
count1        equ countram+1
count2        equ countram+2
As the single stepping debugger can run one instruction at a time you can simulate without delays just to confirm your target PIC has entered debug.
So blinking an LED at 20MHz

Thanks for your reply and your constructive criticism. i would like to talk to you more about that, but first is it possible for you to sent me a piece of code that you know will work so that i can know 100% that i have built the inchworm+ and my target board properly? i want to eliminate myself and my code writing.
it would be good to see it all working so that i can start to concentrate on writing good codes.
Thank you
 
sorry



Thanks for your reply and your constructive criticism. i would like to talk to you more about that, but first is it possible for you to sent me a piece of code that you know will work so that i can know 100% that i have built the inchworm+ and my target board properly? i want to eliminate myself and my code writing.
it would be good to see it all working so that i can start to concentrate on writing good codes.
Thank you
 
Sure I'll attach a program for the debugger on a 16F877A (I'm writing it on a 16F887 but will modify it for the 877A)
Code:
    list    p=16f877A
    include <p16F877A.inc>
    errorlevel -302 
    __CONFIG _LVP_OFF & _WDT_OFF & _HS_OSC
    ORG    0x00
start  bsf    STATUS, RP0     ;B1
    bcf    TRISB,0         ; PORTB.0 output
    bcf    STATUS, RP0     ;B0
begin  bcf     PORTB,0         ; PORTB.0 is 0 (led is off)
    nop                     ; avoid the RMW bug
    bsf    PORTB,0        ; PORTB.0 is 1 (led is on)
    nop                     ; avoid the RMW bug
    goto    begin
    end
Use this with the debug mode, and run animated. Add your delay to the code as a call not a module until you're more familiar with MPASM
 
Hi Bill.

Thanks for the code, But I still get the same error.

Auto-connect not enabled - Not connecting (Try enabling auto-connect on the ICD2 settings pages.)
Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC16F877A found, revision = Rev 0x8
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 Ready
Programming Target...
...Validating configuration fields
ICDWarn0041: You have selected memories to be programmed which require the target device to be erased before programming. However you have not selected "Erase All Before Programming". Would you like MPLAB ICD 2 to select "Erase All Before Progrmming" for you?
...Programming Program Memory (0x0 - 0x1EFF)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Failed (and stopped)
ICD0161: Verify failed (MemType = Config, Address = 0x2007, Expected Val = 0xF77A, Val Read = 0x0)
ICD0275: Programming failed.
MPLAB ICD 2 Ready
Resetting Target
MPLAB ICD 2 Ready

This is the build in the output window


Debug build of project `C:\dav asm\test2\testled2.disposable_mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD2=1'.
Debug platform options are: `__ICD2RAM=1'.
Sat Jan 12 08:58:49 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\dav asm\test2\testled2.mcs".
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F877A "testled2.asm" /l"testled2.lst" /e"testled2.err" /d__DEBUG=1
Loaded C:\dav asm\test2\testled2.cod.
----------------------------------------------------------------------
Debug build of project `C:\dav asm\test2\testled2.disposable_mcp' succeeded.
Preprocessor symbol `__DEBUG' is defined.
Target debug platform is `__MPLAB_DEBUGGER_ICD2=1'.
Debug platform options are: `__ICD2RAM=1'.
Sat Jan 12 08:59:56 2008
SUCCEEDED
----------------------------------------------------------------------

when i do a config verify in the programmer mode i get no errors and the code work fine, but in debugger mode i always get this error. when i do a read part all of the program memory is 0x0000 and RRRRR wheir the debug executive is, so i'm out of idea's
 
Well the 16F877 requires erasing before programming, not sure why you turned it off. I didn't have an 877A handy so I used an 877 and ran the demo code I posted through it. Can you post your corrected code and I'll try it again?
Code:
Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device PIC16F877 found, revision = b4,b5,b6
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 Ready
Resetting Target
Resetting Target
MPLAB ICD 2 Ready
MPLAB ICD 2 Ready
Programming Target...
...Validating configuration fields
...Erasing Part
...Programming Program Memory (0x0 - 0x7)
...Loading DebugExecutive
...Programming DebugExecutive
...Programming Debug Vector
Verifying...
...Program Memory
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
...Programming succeeded
11-Jan-2008, 19:37:26

MPLAB ICD 2 Ready
That's what you should get. If MPLAB complains about settings you should pay attention to them.
 
Because i can not get it to work i was trying different thing in the debug setting but notthing seems to work. all i did with the code you sent me was to copy and paste some of the delay to make it one file.
 

Attachments

  • testled2.asm
    1.4 KB · Views: 103
Your program debugs fine on mine. Your 16F877A may be damaged, do you have another to try. Also this error bothers me.
ICDWarn0041: You have selected memories to be programmed which require the target device to be erased before programming. However you have not selected "Erase All Before Programming". Would you like MPLAB ICD 2 to select "Erase All Before Progrmming" for you?
Your listing indicates you did not allow an erase all before programming or debugging. I'm not even sure how you disabled it.
 
the 16f877a in my target board? or inchworm? under debug/setting/program tabs you can tick or un tick preferences. i was trying different setting to see if it made it work. i unplugged the target board and plugged it in my stand alone programmer which uses winpic software in jdm2, i did a read part and the code was there and so was the debug executive. so i don't know whats going on. what mplab version are you using?
 
I'm using MPLAB 8.01.
The 16F877A has to be bulk erased before programming. The targets clock must be operating too.
Has the warn 041 error gone away?
 
your program gave the same error.what is that problem?can you help me..

------------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\QUAKE\Belgelerim\mplabdeneme\deneme3.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Mon Nov 03 17:09:01 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Documents and Settings\QUAKE\Belgelerim\mplabdeneme\deneme3.mcs".
Clean: Done.
Build aborted. The project contains no source files.
----------------------------------------------------------------------
Debug build of project `C:\Documents and Settings\QUAKE\Belgelerim\mplabdeneme\deneme3.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Mon Nov 03 17:09:01 2008
----------------------------------------------------------------------
BUILD FAILED

--------------
--------------

Code:

list p=16f877A
include <p16F877A.inc>
errorlevel -302
__CONFIG _LVP_OFF & _WDT_OFF & _HS_OSC
ORG 0x00
start bsf STATUS, RP0 ;B1
bcf TRISB,0 ; PORTB.0 output
bcf STATUS, RP0 ;B0
begin bcf PORTB,0 ; PORTB.0 is 0 (led is off)
nop ; avoid the RMW bug
bsf PORTB,0 ; PORTB.0 is 1 (led is on)
nop ; avoid the RMW bug
goto begin
end
 
----------------------------------------------------------------------
Debug build of project `C:\Junebug\Blnk.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Mon Nov 03 13:01:46 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Junebug\Blnk.mcs".
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F877A "Blnk.asm" /l"Blnk.lst" /e"Blnk.err" /d__DEBUG=1
Warning[207] C:\JUNEBUG\BLNK.ASM 9 : Found label after column 1. (begin)
Loaded C:\Junebug\Blnk.cod.
----------------------------------------------------------------------
Debug build of project `C:\Junebug\Blnk.mcp' succeeded.
Preprocessor symbol `__DEBUG' is defined.
Mon Nov 03 13:01:47 2008
----------------------------------------------------------------------
BUILD SUCCEEDED

You've got to include indenting on the program. Works fine for me.

Code:
    list p=16f877A
    include <p16F877A.inc>
    errorlevel -302
    __CONFIG _LVP_OFF & _WDT_OFF & _HS_OSC
    ORG 0x00
start bsf STATUS, RP0 ;B1
    bcf TRISB,0 ; PORTB.0 output
    bcf STATUS, RP0 ;B0
    begin bcf PORTB,0 ; PORTB.0 is 0 (led is off)
    nop ; avoid the RMW bug
    bsf PORTB,0 ; PORTB.0 is 1 (led is on)
    nop ; avoid the RMW bug
    goto begin
    end
 
You've got to include indenting on the program. Works fine for me.

Code:
    list p=16f877A
    include <p16F877A.inc>
    errorlevel -302
    __CONFIG _LVP_OFF & _WDT_OFF & _HS_OSC
    ORG 0x00
start bsf STATUS, RP0 ;B1
    bcf TRISB,0 ; PORTB.0 output
    bcf STATUS, RP0 ;B0
begin bcf PORTB,0 ; PORTB.0 is 0 (led is off)
    nop ; avoid the RMW bug
    bsf PORTB,0 ; PORTB.0 is 1 (led is on)
    nop ; avoid the RMW bug
    goto begin
    end

I have brought line # 9 to line start, and the single error also avoided, Bill
whether any delay is needed at line#10 and #12 ?
 
Last edited:
From the error message above, you have no source file in your project. You have to add the .asm file to your project. See attached.

Mike.
 

Attachments

  • Project.png
    Project.png
    13.3 KB · Views: 111
Status
Not open for further replies.

Latest threads

Back
Top