Last edited by skimask; - 27th March 2007 at 18:50. Reason: never mind
This is another one of those examples where arrays act differently depending on whether a Constant or a Variable is used as the index.
Using the same statement...
owout pin.0[index], 1, ["data here"]
If index is a Constant, it does what you thought, and will use the index to select the Pin as an offset from PORTA.0. So 8 would be PORTB.0. But then, you can't change it at run-time.
IF index is a variable, then it makes it an Array operation that will read the value of the indexed Pin (0 or 1), that value then becomes the "PIN Number".
When a statement works 2 different ways like that it's hard to grasp sometimes.
Not sure why meLabs did things that way.
<br>
DT
Might be the difference between a $250 compiler and a $2,500 compiler.
But I got what you were getting at.
I think the original post'ers only option is to do the SELECT CASE thing, combine all OWOUT's into one place, use a generic "data here" string type array variable and go with it.
Well, I think Josuetas' best option can be found in Post #4I think the original post'ers only option is to do the SELECT CASE thing,
<br>
DT
Then you would change the PORTL and or PORTH assignments in the .bas file for the chip you are using.True, but what if the pins are on PortA, or D, or E, or F, or G, or H, or J
PORTL and PORTH determine which ports are used for "Pin Numbers".
PORTL is 0-7
PORTH is 8-15
<br>
DT
Are you talking about the .bas file in the PBP directory?
I would've thought the compiler would go nuts if you changed anything in those .bas files... I know you can change the .inc files....hmm... interesting thoughts brewing in my head now...
Thanks a lot...now I got more crap to think about!![]()
Hi Darrel,
I have looked in the .bas file for the 18F452 and located the following code
Would I be correct in assuming that you also have to "adjust" the TRISL and TRISH aliases as well?Code:PORTL VAR PORTB PORTH VAR PORTC TRISL VAR TRISB TRISH VAR TRISC
I take it that the ports dont have to be consecutive so that I could put
Which would give me 0-7 = PortB.0-PortB.7 and 8-15 = PortD.0-PortD.7Code:PORTL VAR PORTB PORTH VAR PORTD TRISL VAR TRISB TRISH VAR TRISD
If so that greatly simplifies something I am trying to impliment. The reason I want to change PORTH from C to D is that I need to use the USART which is on C6 and C7 so that would only give me 14 useable pins.
DOH !!!!
Thatll teach me not to make sure I have a newly refreshed view of a thread before I post a reply !!!!
Last edited by keithdoxey; - 27th March 2007 at 20:37. Reason: Explaining why I look like a Dumba$$
Keith
www.diyha.co.uk
www.kat5.tv
Bookmarks