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.

Need a hand using my ICD2

Status
Not open for further replies.

GRC

New Member
Hello all
Recently built an ICD2, now I'm having trouble loading a program
into a 16f628A. Heres a piece of code from Nigel site


Processor 16F628A
#inclde "p16f628a"
_config _CP_OFF & _WDT_OFF & _PWRTE_ON & _INT_OSC

;List p=16f628a
;include "P16F28A"
;-config 0x3D18

org 0x0000

movlw 0x07
movwf CMCON

bsf STATUS, RPO
movlw b'00000000
movwf TRISB
movwf TRISA
bcf STATUS

loop
movlf 0xff
movwf PORTA
movwf PORTB
nop
nop
movlw 0x000
movwf PORTA
movwf PORTB
goto loop

end


I know the code will turn the LEDs on and off so fast that they'll
appear to lit the entire time. But nothing seems to happen at
all. The problem is with my ability to MPLAB. The help file has
been that much so far.

This site

**broken link removed**

has been the most helpful so far(project wizard, new project,etc),
still missing something. I get the following messages from the MPLAB
IDE




Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
ICDWarn0020: Invalid target device id (expected=0x89, read=0x83)
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 Ready
Programming Target...
ICDWarn0013: Low Voltage Programming cannot be enabled when ICD 2 is used as a debugger. Disable Low Voltage Programming?
ICDWarn0014: Watchdog Timer cannot be enabled when ICD 2 is enabled as a debugger. Disable Watchdog Timer?
...Erasing Part
...Loading DebugExecutive
...Programming Debug Vector
Verifying...
...Debug Executive
...Debug Vector
...Verify Succeeded
Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Verify Succeeded
Connecting to debug executive
Entering Debug Mode
...Programming GOTO 0x00 command
ICD0083: Target not in debug mode, unable to perform operation
MPLAB ICD 2 Ready


Any thoughts/suggestions are welcomed.
Gordon
 
Also note, I believe the Config setting are set wrong with the post
above, tried sevreal others with no luck.

Thanks again
Gordon
 
Hello GRC,

Don't rush it.

You should first set your aim to program a PIC to operate correctly using ICD2 with a working program and only after that then you learn how to debug it. So your first task should be making a LED flashing correctly.

Take time to read about the meaning of the configuration bits and method of setting them(in the source file or directly in MPLAB). Also the error messages from MPLAB IDE gives a lot of hints of what is going wrong and one need to resolve them all before one can debug the target. There are special requirement of the first instruction of the asm source file to enable the debug operation.

The ASM file you are using has many spelling errors like #inclde, RPO... etc...

They should be #include, RP0 (zero, not 'oh')...

It would help others very much if you surround your code with the 'code' formatting in future postings, like following:

Code:
 Processor 16F628A
#inclde "p16f628a"    <<< spelling #include
_config _CP_OFF & _WDT_OFF & _PWRTE_ON & _INT_OSC

;List p=16f628a
;include "P16F28A"
;-config 0x3D18

org 0x0000

movlw 0x07
movwf CMCON

bsf STATUS, RPO   <<<RP0, but they appear to look the same to you
movlw b'00000000  <<< missing ' at end
movwf TRISB
movwf TRISA
bcf STATUS  <<< Which bit you want to clear???

loop
movlf 0xff   <<< no such instruction
movwf PORTA
movwf PORTB
nop
nop
movlw 0x000
movwf PORTA
movwf PORTB
goto loop

end
 
Thanks for finding my errors.
Did not realize that it RP0 (as in zero) and not rpo. Perhaps
slowing down would make learn a bit faster. I'll be sure to post
my code in the code box.

Thanks again for the help
Gordon
 
I can help you with other errors you have:

ICDWarn0020: Invalid target device id (expected=0x89, read=0x83)
Means, that include files, ASM Processor definition and MPLAB device settings mismatch. Make sure that in Configure/Select device you see 16F628A selected.
ICDWarn0013: Low Voltage Programming cannot be enabled when ICD 2 is used as a debugger. Disable Low Voltage Programming?
ICDWarn0014: Watchdog Timer cannot be enabled when ICD 2 is enabled as a debugger. Disable Watchdog Timer?
As eblc1388 said, this has to do with Debugging features of ICD2. You shouldn't try to use them, first try to program the PIC normaly:
Go to Programmer/Select Programmer/ICD2
and Debugger/Select tool/MPLAB SIM.

These steps will use ICD2 as a programmer and use SW simulator inside MPLAB to debug your code.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top