PIC16F876A IDC Run time interrupt


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Posts
    9

    Default PIC16F876A IDC Run time interrupt

    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?

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Are you using any HSER DEFINE's ?

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

  3. #3
    Join Date
    Apr 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Heres what I have so far

    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

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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>
    DT

  5. #5
    Join Date
    Apr 2007
    Posts
    9


    Did you find this post helpful? Yes | No

    Default No

    I am not using the MAX 232...
    I take it is a must!?

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by clem View Post
    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by clem View Post
    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>
    DT

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Add

    And i think it's not the whole thing as well... some variable declaration are missing... AND...
    Code:
    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Interrupt cycle time limitation?
    By jswayze in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th March 2005, 07:11
  4. Interrupt and Time Out
    By Tissy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2005, 01:10
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts