Does 16F628a support debugging or not?


Closed Thread
Results 1 to 19 of 19

Hybrid View

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

    Default Does 16F628a support debugging or not?

    Simple question, please don't answer if you DON'T know!

    Does 16F628a support IDC or not?

    I Googled the question and found 1/2 say it does, 1/2 say it doesn't. Microchip says it doesn't unless you have a daughter board, but Microcode Studio Plus supplies a file to support the 16F628a. So I'm confused.

    I built a Max232 circuit to interface to the 16F628a (which has a USART on chip), but it doesn't work and I verified sending data to the chip with a scope.

    Yes or No?

  2. #2
    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?

    The 16F628A does not have a built-in hardware debugger.
    So what Microchip said is true if you are using one of their programmers as a debugger.

    And anyone that said you can debug a 16F628A with MicroCode Studio was also correct, because MicroCode uses software debugging via the USART and doesn't need a hardware debugging module.

    You can use the serial communicator in MicroCode Studio to verify operation.
    Connect to the port at 19200 baud and send a lowercase 'h'.
    If everything is working properly, it will respond with a 6 digit hexadecimal number.

    Make sure you have compiled the program using the "ICD Compile" or "ICD Compile Program" buttons.
    DT

  3. #3
    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?

    Thanks Darryl, this is exactly the answer I was looking for and even included a hint for something to check. I did check, didn't get the response expected so I'm looking elsewhere for the problem.

  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?

    I went back to the simplest circuit I could make with minimal programming just to test the ICD but I still can't get it to work. I have checked that when I send out a character to my Max232 chip that the signal gets level corrected and sent to the Rx pin of the 16F628a.
    When I "Compile Program" using MCS+ the LED (code below) blinks as required. When I "ICD Compile Program" the blinking stops, and I get a time-out error when I try to run the debugger.
    Using the serial communicator in MCS+, I can send out the character "h" but I get nothing returned. the Bytes TX count goes up by the number of characters I send out and curiously (because I don't know the cause), the Bytes RX count continuously increments rapidly to 16000+ and doesn't quit until I

    Question: Is there anything else I have to do to get the ICD working? (perhaps a config word or register setting?)
    Question: What data am I receiving (RX of 16000+)
    Question: Why does execution stop (ie LED stops blinking) when I "ICD CompileProgram"?

    Program is here:
    TRISA = %00000000 'ALL OUTPUTS
    TrisB = %00000010 'Rx on b.1, pin 7 and Tx on pin 8
    #config
    __config _INTRC_OSC_NOCLKOUT ; for 16F628
    #endconfig
    START:
    High PORTA.6 'ON LED
    Pause 1000
    Low PORTA.6 'OFF LED
    Pause 1000
    GoTo START 'REPEAT

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: Does 16F628a support debugging or not?

    It sounds to me as if the PIC never starts up properly, the TX-pin on the PIC never becomes an output so it floats which probably makes the MAX232 output "the wrong" idle state on its output to the PC so the PC keeps "receiving" bytes. Try forcing the TX output on the PIC into the correct state with a resistor. I believe the correct idle state of the TX-line is high and because the MAX232 inverts the signal you should pull it low but I might have that the wrong way around.

    Now, this doesn't adress the real problem of WHY the PIC doesn't start up properly, have you measured or scoped the voltage on the MCLR-pin to verify that it's not kept in reset?

    /Henrik.

  6. #6
    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

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