If you're not using Timer0, set it up for external clock, strap T0CKI to ground, and you have yourself a spare byte variable.
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
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
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".If you want you can create an alias for TMR0 like any other 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 byteNow 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.Code:B0 VAR TMR0
I hope that helps and that it is what Bruce was thinking.
/Henrik.
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
Bookmarks