I am sure there are other ways...
Ioannis
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
Since you start your offset value (the FOR loop) at 1 it the first bit to be set will be "one away" from PortA.0, in other words PortA.1 and then contiune 32 bits "up from there", so you will write to the first bit of the register comming after PortD - that can ruin your day.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).
But, as Richard says, TRY IT for crying out loud :-) Investigate how it works, does it do what you expect, change something and see if you get the expected result and if not think about WHY.
Bookmarks