debug timeout issue 12F683


Closed Thread
Results 1 to 8 of 8
  1. #1

    Question debug timeout issue 12F683

    Hello,

    I can't seem to find why the debugin does not time out after 200ms and jump to a label. I can set the port in the PowerOn_init section and drop to the debugin...but never jumps to the time out label....why? code is below.

    INCLUDE "Modedefs.Bas"
    DEFINE OSC 8
    @ DEVICE PIC12F683, MCLR_OFF, HS_OSC, INTRC_OSC_NOCLKOUT,protect_off


    DEFINE DEBUGIN_REG GPIO ' Set as software RX in
    DEFINE DEBUG_BAUD 2400 ' Set bit rate
    DEFINE DEBUGIN_BIT 0 ' Set GPIO bit 0
    DEFINE DEBUGIN_MODE 1 ' Set Debugin mode: 0 = true, 1 = inverted


    TRISIO = %00000001
    ANSEL = %00000000
    ADCON0 = 0
    CMCON0 = 7 ' Disable comparator
    VRCON = 0 ' CVreff = OFF
    CCP1CON = %00001100 ' PWM mode
    PR2 = 249 '
    T2CON = %00000100 ' Start Timer2, Prescaller 1:1


    Rudder VAR byte
    Duty VAR WORD
    PWM_ON CON %00001100
    PWM_OFF CON 0


    PowerOn_init:
    GPIO = 0
    CCP1CON = PWM_OFF
    Duty = 0
    CCPR1L = Duty
    CCP1CON.5 = Duty.1
    CCP1CON.4 = Duty.0
    PAUSE 500 ' OSC settle delay
    CCP1CON = PWM_ON ' turn on motor at low speed for 500ms
    Duty = 50
    CCPR1L = Duty
    CCP1CON.5 = Duty.1
    CCP1CON.4 = Duty.0
    pause 500
    Duty = 0
    CCPR1L = Duty
    CCP1CON.5 = Duty.1
    CCP1CON.4 = Duty.0
    pause 50
    GPIO.4 = 1 ; set to test whether time out works for debugin.



    Start:

    debugin 200,Alloff,[wait (85), Duty, Rudder]


    If duty < 10 then ' shut down throttle if threshold is too low
    duty = 0
    endif

    CCPR1L = Duty ' PWM duty cycle
    CCP1CON.5 = Duty.1
    CCP1CON.4 = Duty.0

    If Rudder = 192 then ' 11000000 rudder left
    GPIO.5 = 1
    else
    GPIO.5 = 0
    endif

    If Rudder = 12 then ' 00001100 rudder right
    GPIO.4 = 1
    else
    GPIO.4 = 0
    endif

    GOTO Start

    Alloff:
    duty = 0
    CCPR1L = Duty ' PWM duty cycle
    CCP1CON.5 = Duty.1
    CCP1CON.4 = Duty.0
    GPIO.4 = 0
    GPIO.5 = 0
    goto start

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Most likely it's due to noise on the input pin, which resets the timeout. Are you trying to
    read data from an RF receiver?

    P.S. You can't have both HS_OSC and INTRC_OSC_NOCLKOUT, and if you're wanting to
    use the 8MHz internal, you need to write to OSCCON.
    Last edited by Bruce; - 10th February 2010 at 20:44. Reason: PS
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Bruce, thanks for catching that

    I am using an IR module. Very quiet, not seeing anything that would cause it to reset. I will try scoping it out on a 2 channel, 1 channel IR data out and 2nd channel I/O pin. I don't think that is the problem though.

    Nick

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Nick,

    DEFINE OSC 8 with it running on the default 4MHz internal would definitely do it.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I made the changes to the oscillator configuration. I set up a I/O toggle with 100ms pause and I am seeing the correct timing of the test code. since the pause command derrives it's timing from the osc, I am assume it is running at 8Mhz. modified code below.


    INCLUDE "Modedefs.Bas"

    DEFINE OSC 8

    @ DEVICE PIC12F683, MCLR_OFF,INTRC_OSC_NOCLKOUT,protect_off

    DEFINE DEBUGIN_REG GPIO ' Set as software RX in
    DEFINE DEBUG_BAUD 2400 ' Set bit rate
    DEFINE DEBUGIN_BIT 0 ' Set GPIO bit 0
    DEFINE DEBUGIN_MODE 1 ' Set Debugin mode: 0 = true, 1 = inverted

    OSCCON = %01110001 ' set internal 8MHz
    TRISIO = %00000001
    ANSEL = %00000000
    ADCON0 = 0
    CMCON0 = 7 ' Disable comparator
    VRCON = 0 ' CVreff = OFF
    CCP1CON = %00001100 ' PWM mode
    PR2 = 249 '
    T2CON = %00000100 ' Start Timer2, Prescaller 1:1


    Rudder VAR byte
    Duty VAR WORD
    PWM_ON CON %00001100
    PWM_OFF CON 0


    test:
    GPIO.4 = 1
    pause 100
    GPIO.4 = 0
    pause 100
    goto test

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    OSCCON = %01110001 should get you running at 8MHz internal, but you might want to
    change to DEFINE DEBUGIN_MODE 0 ' for true mode. Most IR modules idle high. Inverted
    mode serial inputs should idle low.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7


    Did you find this post helpful? Yes | No

    Talking

    Bruce, that did it. The debugin time out was being hosed by the pull up on the IR data out. Thanks for the help!!!!

    Nick

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Glad I could help. Wait until the new 8-pin 12F1822s' come out. Then you can use the
    hardware USART to receive IR data in the background using DT_INTs....
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. N-Bit_MATH
    By Darrel Taylor in forum Code Examples
    Replies: 38
    Last Post: - 16th December 2010, 14:48
  2. About USB
    By dias11 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 3rd December 2009, 20:41
  3. debug not working with MPASM assempler
    By santamaria in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th March 2009, 07:51
  4. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  5. 18F1320 ... Strange Memory
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 43
    Last Post: - 9th April 2006, 09:55

Members who have read this thread : 1

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