Simple.
To make code shorter.
I've posted an example above. Yes it works but I have 40 subroutines and 40 IF THEN's in it. In case of redefinable port<>variable, it would be reduced 4 times.
Simple.
To make code shorter.
I've posted an example above. Yes it works but I have 40 subroutines and 40 IF THEN's in it. In case of redefinable port<>variable, it would be reduced 4 times.
I am sure there are other ways...
Ioannis
you can lead a horse to water but ....
any pin can be addressed with PORTA.0[offset]
Warning I'm not a teacher
So say
FOR A=1 to 20
HIGH PORTA+A
NEXT
will work?
do you think that looks even close ?So say
FOR A=1 to 20
HIGH PORTA+A
NEXT
will work?
assuming the 18 [chip dependent] pins in that range are set as digital outputCode:FOR A=0 to 20 PORTA.0[A]=1 NEXT
Warning I'm not a teacher
I don't mean to be rude or to offend anyone but do you actually read and/or try any of the solutions you are provided with - for free - here or is the purpose of your post simply to vent your ideas on how you EXPECT expect everytning to work and then continue doing it "your way"?
Several times now you've been shown the correct syntax to access any pin using an offset and it's (for example, using PortA.0 as the "base address") PortA.0[offset] and yet you ask if PORTA+A will work, I'm sorry but I don't get it. And to be perfectly clear, no, PORTA+A will not do what you want.
So in your example:I would not use HIGH though but instead PORTA.0[A] = 1 since that will produce smaller and faster code and it will work provided TRIS are cleared for the pins in question.Code:FOR A=1 to 20 HIGH PORTA.0[A] NEXT
/Henrik.
Well you're the pros, for me a lot of these strange brackets and other syntax things are quite hard to understand, because I've learned BASIC on ZX Spectrum, almost 35 years agoSo I'm asking to clarify.
So back to this:
FOR A=1 to 32
PORTA.0[A]=1
NEXT
Will make all ports of PORTA/PORTB/PORTC/PORTD high in sequence, right? (All TRIS and other yada-yada are already set).
if it does not work post code and schematic of your attempt, its a simple test
Warning I'm not a teacher
Bookmarks