Does 16F628a support debugging or not?


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    Your __config line doesn't have enough options in it ...
    Code:
    #CONFIG
        __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
    #ENDCONFIG
    When using #CONFIG/#ENDCONFIG, ALL defaults are overridden and you must supply ALL config options.
    The way it was would have left LVP ON.

    This program with a 16F628A in an melabs LAB-X3 board, works fine with the ICD.
    Code:
    #CONFIG
        __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
    #ENDCONFIG
    
    DEFINE OSC 4
    
    LED1  VAR PORTB.4
    CMCON = 7
    
    Main:
        HIGH LED1
        PAUSE 500
        LOW LED1
        PAUSE 500
    GOTO Main
    But the ICD will never work if RS232 comms are not working.
    Here's a simple LoopBack program. Compile it with the normal "Compile Program" button.
    Use Serial Communicator at 19200, and whatever you send should be returned.
    Once you get that working (strictly a hardware issue), the ICD will work.
    Code:
    #CONFIG
        __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _BOREN_OFF & _LVP_OFF & _CPD_OFF & _CP_OFF
    #ENDCONFIG
    
    DEFINE OSC 4
    
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 12  ' 19200 Baud @ 4MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    Char  VAR BYTE
    
    CMCON = 7
    
    Main:
        HSERIN [Char]
        HSEROUT [Char]
    GOTO Main
    DT

  2. #2
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    First I did as Henrik suggested, trying to pull down the Tx line (100 ohms, didn't work). The MCLR is high, not reset.

    Then I changed the Config statement per Dave, in my own program. Didn't change anything: LED blinks when normal compile, but won't blink on ICD compile.

    So I ran Dave's program but my PortA.7 (since LED was there). His had CMCon=7, otherwise program is the same. Got same results. So I used EXACTLY Dave's program ie PortB.4 and still the same results.

    Bottom line: program works when I normal compile, doesn't work when I ICD compile.

    NOTE: the RS232 lines were NOT connected whatsoever, the power for my breadboarded circuit (the 16F628a) is from the LABX-1 to make sure it's clean power, and the CONFIG statement Dave provided cannot have the CPD_OFF fuse because it doesn't exist in a 16F628A.INC file. The program won't compile with CPD_OFF in the string.

    I noted that an ICD compile REALLY adds a LOT of overhead to the ASM file. Could this extra code be trashing memory?

    I don't understand how your program can work on a 16F628a whereas mine won't even compile. I tried a DIFFERENT chip and get the same results.

    I haven't done the loopback yet for obvious reasons.

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


    Did you find this post helpful? Yes | No

    Default

    Dave's not here maaann.

    What version of PBP3 do you have?
    The current version is 3.0.5.x
    http://pbp3.com/download.html

    What version of MPLAB do you have?
    Current version - 8.85
    The latest PBP3 will install MPLAB 8.84
    DT

  4. #4
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    Sorry Darrel...I know another guy named Dave Taylor.
    I have MCS 5.0.0.3
    PBPX 3.0.1.4
    MPLAB 8.73

    Since I'm grasping at straws here, I will do all the updates.

    BTW, Ran the serial test program you sent me. No matter what character I send out, I get a weird character back, like it's a baud rate problem. I changed baud rates in software to 9600 and the serial comm to same but it still gives same results. I tried even lower rates, no different. My PC serial card was set for 9600 baud, changed it to 19200 and the program and communicator to same. Same results. Type h, get back an "e" with back slanting accent.

  5. #5
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    Darrel, I upgraded MPLAB, MCS+ and PBP3.0 as required. No change.
    However, I changed power supply to my circuit, the 16F628a and MAX232 chip. Instead of using the limited power supply of the LabX1, I used my other supply, a switching walwart supply. NOW my serial communicator works first time everytime. Type an "h", get an "h".
    Obviously I was stressing the LabX1 supply and must have caused it to clip or get noisy.

    Still have the compile ICD that doesn't work.

  6. #6
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    I have since got my program working on the 16F628 and DO NOT NEED the ICD to troubleshoot it, but I really want to make it work non-the-less for future.

    My serial input works. ICD compile works to the point where I can compile and program, but when I hit RUN, it errors out with a timeout error.

    ICD compile works okay with my 16F887 on the LabX1 board.

    Any ideas?

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


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    and the CONFIG statement Dave provided cannot have the CPD_OFF fuse because it doesn't exist in a 16F628A.INC file. The program won't compile with CPD_OFF in the string.
    ...

    I have MCS 5.0.0.3
    PBPX 3.0.1.4

    ...

    Darrel, I upgraded MPLAB, MCS+ and PBP3.0 as required. No change.
    Are you saying that you still can't compile with _CPD_OFF in the config line, even after updating?
    If so, you may be compiling for the wrong chip.

    My serial input works.
    And what about the loopback? Do you have that working.
    DT

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