View previous topic :: View next topic |
Author |
Message |
kg6vkg
Joined: 25 Nov 2005 Posts: 13 Location: San Diego
|
Problems debugging 16F690 |
Posted: Sat Dec 03, 2005 7:48 pm |
|
|
Greetings I bought CCS PCWH two weeks ago in order to finish my senior project. I was able to for the most part program a 18F4520 to run a display and decode a 4x4 keypad. Now I am trying to program the 16F690 to drive an H bridge and take an analog input. THe two chips are going to communicate via i2c. Here is my setup:
compiler: PCWH ver 3.239
Microcontroller: 16F690
Mode: Works in Standard, not in debug
Target voltage: 5v
oscillator: 4Mhz crystal with caps
My problem is that I can't get the debugger in PCWH to work on this chip. When I turn on the debugger it starts with "ataching", then "Loading, and then "busy". THen I get an error: "Could not start target: The target was not halted after reset Check the targer oscillator and MCLR".
In order to verify my circuit I wrote a simple program to flash a light in MPLAP IDE switched to the ICD-2 instead of the ICD-U40, and it worked fine. I am only getting this error when trying to debug within PCWH.
If I go to tools, then choose ICD. The program loads fine. and I get the message that the chip should be running. And I can see the lights turing on and off.
Does this sound familiar to anyone else? I would really appriciate any help that I can get.
Here is my code:
Code: |
#include "D:\ControlLogic\ControlPIC.h"
#int_SSP
#define GREEN_LED PIN_B7
SSP_isr()
{
}
#int_TIMER0
TIMER0_isr()
{
}
void main()
{
setup_adc_ports(sAN2|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_1,0,1);
setup_ccp1(CCP_PWM);
// setup_comparator( setup_vref(FALSE));
enable_interrupts(INT_SSP);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
setup_oscillator(False);
while (TRUE) {
output_low (GREEN_LED);
delay_ms (1000);
output_high (GREEN_LED);
delay_ms (1000);
}
}
|
If you need any other of the code let me know. Thanks for your time.
Mark |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
kg6vkg
Joined: 25 Nov 2005 Posts: 13 Location: San Diego
|
That would explain alot |
Posted: Sun Dec 04, 2005 2:20 am |
|
|
Thanks for for the heads up.
-Mark |
|
|
kg6vkg
Joined: 25 Nov 2005 Posts: 13 Location: San Diego
|
One more question |
Posted: Sun Dec 04, 2005 2:23 am |
|
|
On the page you linked me to there is # sign next to it as follows:
PIC16F690 #
And at the bottom of the page it says:
# Indicates a special -ICD part is required for debugging
Any idea what that special part would be?
Thanks, Mark |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Dec 04, 2005 2:50 am |
|
|
Here's the document that describes the headers used for the ICD2.
Generally, it's the smaller PICs that require a special header to do
debugging. The document explains the various reasons why.
The chart on page 2 of the document shows that p/n AC162061 is the
header for the 16F690.
http://ww1.microchip.com/downloads/en/DeviceDoc/ICD2_Header_51292L.pdf |
|
|
|