Debugin Causesing Restart


Closed Thread
Results 1 to 2 of 2
  1. #1
    IceCube's Avatar
    IceCube Guest

    Default Debugin Causesing Restart

    Hi,

    Can someone please tell me what I am doing wrong.
    I want to DEGUGIN a character and branch according to its value.
    However, typing any character causes a reset!!

    Thank you
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    @ LIST P=PIC16F648A
    @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BODEN_ON & _PWRTE_ON

    DEFINE OSC 04

    Define DEBUG_REG PORTB
    Define DEBUG_BIT 5
    define DEBUG_BAUD 9600
    Define DEBUG_MODE 1

    Define DEBUGIN_REG PORTB
    Define DEBUGIN_BIT 4
    Define DEBUGIN_BAUD 9600
    Define DEBUGIN_MODE 1

    x var byte
    CR con $0D 'Carriage Return
    LF con $0A 'Line Feed

    Start: CMCON = 7
    PortA = 0:TRISA = 0
    PortB = 0:TRISB = 0
    PIR1 = 0
    PIE1 = 0
    clear
    pause 500
    debug "We are alive...",cr,lf ' Say hello
    pause 500

    TestLoop: debug "Enter A or B "
    debugin 20000,NoReply,[x] ' wait 20 seconds reply
    debug x,cr,lf 'echo back
    if x="A" then debug "AAAAAAAA",cr,lf
    if x="B" then debug "BBBBBBBB",cr,lf
    pause 500
    goto TestLoop
    NoReply: debug "TimeOut...",cr,lf
    pause 500
    goto TestLoop

    end

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


    Did you find this post helpful? Yes | No

    Default

    You currently have the pin that is to be receiving the character set as an output.

    PortB = 0:TRISB = 0

    Since the debug mode is 1, it's using inverted rs232. Inverted rs232 will idle low, so as long as it's idling everything will be ok.

    Once you try to send something the input will go high, but since the pin is set to output and initialized low, you effectively have a short. This will cause a reset.

    Also, there is no Define DEBUGIN_BAUD
    The IN baudrate is always the same as the DEBUG_BAUD

    HTH,
        Darrel

Similar Threads

  1. Debugin
    By tbh9365 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 14th January 2008, 22:14
  2. DEBUGIN not working on 12F629
    By fredpret in forum Serial
    Replies: 1
    Last Post: - 22nd September 2007, 11:39
  3. Restart 18F2620
    By cerio in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 27th June 2007, 14:29
  4. Serin / Serin2 / Debugin Differences
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th January 2006, 06:32
  5. Debugin problem
    By moby in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th September 2004, 15:12

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