PDA

View Full Version : PIC16F876A IDC Run time interrupt



clem
- 19th April 2007, 19:08
I'm using a melabs U2/USB Programmer w/ Microcode studio plus - PICBASIC PRO.
I've followed the instructions for physical connections and precautions on the MELabs website entitled "In-Circuit Serial Programming (ICSP) with the EPIC™ Programmer, melabs Serial Programmer, or melabs U2/USB Programmer"
When I perform a standard compile and program the PIC works great, when I try an ICD compile and program it appears to complete but when I try to run the program I get an ICD connection timeout.
I tried the Oscillator Setting, the Disable Debug Directive, the Define loader and physically resetting the PIC at the MCLR pin.
What could possibly be the issue?

Darrel Taylor
- 19th April 2007, 19:45
Are you using any HSER DEFINE's ?

If so, comment them out.
MCSP sets the baud rate for the USART while debugging
<br>

clem
- 19th April 2007, 20:01
PULSE VAR PORTC.2
RL1 VAR PORTC.1
RL2 VAR PORTC.0
HEATIN VAR PORTA.1
SENSIN VAR PORTA.0
ADCON1 = 0011 'Declare A ports 0 & 1 as Analog to dig converters
ADCON1.7 = 1 'Analog to Digital variables declared right justified
TRISA = 255
DEFINE ADC_BITS 10 '10 bit conversion used
DEFINE ADC_SAMPLEUS 5 'set sample time
SENSVAL VAR Byte
DEFINE LOADER_USED 1
DISABLE DEBUG


loop_delay CON 500 ' adjust to tweak timing
ms_count VAR WORD


loop:

FOR ms_count = 0 TO 999 ' 0 to 999mS

IF ms_count < 14 THEN ' PULSE low 0 to 13 mS
low PULSE
ELSE ' PULSE and RL1 high at 14
high PULSE
high RL1
high RL2
ENDIF

IF MS_count > 8 THEN ' RL1 low at 9 mS
high RL2
ENDIF

IF ms_count > 995 THEN ' RL2 low at 995 mS, high at 0
low RL1
ENDIF

IF ms_count = 997 THEN ' Read PORTA.0 ADC VALUE put in mem loc 0
ADCIN PORTA.0, SENSVAL
ENDIF

IF ms_count < 500 THEN
High 0
ENDIF

IF ms_count > 499 THEN
low 0
ENDIF

IF ms_count < 500 THEN
low 1
ENDIF

IF ms_count > 499 THEN
high 1
ENDIF

PAUSEUS loop_delay ' fill in time for 1mS loop

NEXT ms_count

goto loop
END

Darrel Taylor
- 19th April 2007, 20:09
Are you using a MAX232 between the USART and the PC.

Or, are you trying to use the melabs U2 to debug. (won't work)

Also, 99% of your program is disabled. Remove the DISABLE DEBUG.
<br>

clem
- 19th April 2007, 20:12
I am not using the MAX 232...
I take it is a must!?

mister_e
- 19th April 2007, 20:13
And i think it's not the whole thing as well... some variable declaration are missing... AND...

ADCON1 = 0011 'Declare A ports 0 & 1 as Analog to dig converters
unless there's a copy/paste error here, it may screw few things... No i didn't open TFM to know how much ADCON=11 is different of ADCON1=%0011

mister_e
- 19th April 2007, 20:14
I am not using the MAX 232...
I take it is a must!?

Yes Indeed, look the Help file... under the Hardware requirement. You'll discover something interesting ;)

tutorial
http://www.rentron.com/PicBasic/MCS_X3.htm

schematic
http://www.rentron.com/images/004LOAD.GIF

Darrel Taylor
- 19th April 2007, 20:16
I am not using the MAX 232...
I take it is a must!?

Yes, it's a MUST.

Microcode Studio's ICD communicates with the PIC via the RS232 port, and uses the USART on the PIC.
There's no other way to do it.
<br>

clem
- 19th April 2007, 20:18
Thank you guys so much this is a huge help!!!!!!

Jim-

mister_e
- 19th April 2007, 20:19
You're welcome, good luck!