issue with DEBUG, please help


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    May 2011
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: issue with DEBUG, please help

    Doing some test, I realized that it is the instruction:
    OPTION_REG = OPTION_REG & $80 | 1 ; Set TMR0 Prescaler to 256, leave RBPU alone

    which makes the DEBUG to produce garbage, as if the baud rate was wrong. This line was taken from the example of Darrel for the clock. So it seems it affects the DEBUG instruction.
    Could someone explain me the root cause and how to overcome this issue.
    This is my first attempt at using timer and interrupt and I am really in unknown territory here. I will keep doing some reading but any help will be highly appreciated.
    thanks,
    Olivier

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,623


    Did you find this post helpful? Yes | No

    Default Re: issue with DEBUG, please help

    Hi,

    If an interrupt occurs while the DEBUG statement is busy outputting data it will, as the mechanism name implies, be interrupted and since it's a bitbanged software timed routine its timing will be off which in turn means garbage data.

    Either use the USART ("manually" or with HSEROUT) to send the data or make sure to turn off or mask the interrupts WHILE the DEBUG statement is executing.

    /Henrik.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,681


    Did you find this post helpful? Yes | No

    Default Re: issue with DEBUG, please help

    OPTION_REG = OPTION_REG & $80 | 1 ; Set TMR0 Prescaler to 256, leave RBPU alone
    por value for OPTION_REG is 255 (0b11111111)

    OPTION_REG & $80 | 1 results in OPTION_REG =129 (0b10000001)
    that is not the result you are describing in your comment ; Set TMR0 Prescaler to 256, leave RBPU alone
    it also sets the int Interrupt to falling edge of INT pin
    for 256 prescaler OPTION_REG bits 0:2 = 0b111

    next issue your code is not posted in code tags which makes life difficult .

    what do you think will happen to the bit timing accuracy of a software timed serial output routine like debug when you interrupt it 100's of times per second

  4. #4
    Join Date
    May 2011
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Re: issue with DEBUG, please help

    Thank you for the explanation, it is clear now. I just need to modify my board now to use the USART instead

    And for next time in order to post code properly, what do you call code tags? Is it the "wrap QUOTE tags" option in the editor?

    thanks,
    Olivier

  5. #5
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: issue with DEBUG, please help

    Quote Originally Posted by Lazuli View Post
    And for next time in order to post code properly, what do you call code tags? Is it the "wrap QUOTE tags" option in the editor?
    Code:
    Nope.  You have to go the advanced editor (at least I do) and select 'Wrap CODE tags'.  Looks like this:  #
    Creates a window like this that you can scroll up and down in
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

Similar Threads

  1. DEBUG DEC DatVar vs DEBUG #DatVar
    By netstranger.nz in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th March 2011, 22:26
  2. debug issue?
    By Brian in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th March 2011, 05:27
  3. debug timeout issue 12F683
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th February 2010, 22:44
  4. How do I use DEBUG ?
    By kenpo in forum General
    Replies: 13
    Last Post: - 9th January 2008, 15:54
  5. Code Issue - select case or 'if' issue - not sure why
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th October 2007, 09:52

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