Skip incoming bytes in SERIN


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Smile

    Wow! Gentlemen,

    Thank you for such great help. This saved me 94 of 512 words of memory, so I now can think about adding some other features. Will try how it works in reality this week and let you know.

    Another option could be going with another chip and additional driver chip to interface to a 14 Volt serial I/O line, but this makes the electrical schematic bigger, so I prefer to stay with this chip if possible.

    My understanding is that using DEBUG I will still be able to use the same pin as output before and after the DEBUG.

    Will need to learn more about the TIMER0 and how to configure to save space for one more variable because although I can live without it, it is still good to have. I have to use resonator for having precision timing, not sure it makes a difference or not.

    Thanks again!

    Thanks again

  2. #2
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Hello Gentlemen,
    Checked the Debugin with PIC16F540 and yes, your advise works great, I could read the port and output high and low impulses into it between the serial input.

    Could not find out so far how to reduce use of RAM to get space for one more variable, but at least have enough memory for code now.

    Thank you very much

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I think that is what Bruce was trying to help you with. TMR0 has a byte sized register that you can read and write just like any other variable. If you don't use TMR0 for its intended purposes you can "borrow" its register and use as a normal variable.

    So instead of declaring B0 as a BYTE and use that you simply use the TMR0 "variable".
    Code:
    MyData  VAR BYTE
    
    DEBUGIN [WAIT(85)]       ' wait for 85
    FOR TMR0 = 0 TO 9
        DEBUGIN [MyDATA]     ' skip 9 bytes
    NEXT TMR0
    'Last MyDATA will contain the desired byte
    If you want you can create an alias for TMR0 like any other variable:
    Code:
    B0 VAR TMR0
    Now reading and writing B0 will actually read and write TMR0. Personally I think spelling out TMR0 in the code better shows what is actually going on though.

    I hope that helps and that it is what Bruce was thinking.

    /Henrik.

  4. #4
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Thank you Henrik, Bruce,

    Yes, Bruce was trying to advise this, but I am not as smart in micro controllers as you guys are, so I was going a wrong way thinking there is a way to configure timer somehow and prevent PBP from using some RAM for things related to the timer.

    Thank you for clarifying this for me

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