[En-Nut-Discussion] GPIO on the ethernut board 3.1

Ulrich Prinz uprinz2 at netscape.net
Thu May 6 18:47:38 CEST 2010


You cannot go without double-access.

If you do not reserve one complete port for one single display, you have 
to keep care, that pins not assigned to the display but other periphals 
are not modified.

So, one option is to
read the port
"and out" all zeros
"or in" all ones
write back the port

The second option we use is
"and out" all zeros with the CODR
"or in" all ones with SODR

The result is 2 cycles for our solution, 4 cycles for the first one.
If you think, that some tricky code might optimize the first solution, 
keep in mind, that the compiler will extract this to exactly the steps 
above. There is no way around that "first an, second or" to modify a 
part of a larger variable.

By the way, I got the display driver running. I could put it into trunk 
now, but I'd prefer to modify some parts of it for better configuration 
options and readability.

Best regards, Ulrich

Am 06.05.2010 08:49, schrieb Paul Govers:
> Hello,
>
> i have a question about the GPIO on the Ethernut board 3.1, i was
> wondering
> if it is possible to set the IO port without an "extra step".
> for example:
>
> to set an output i have to use an other register to clear the output.
> if i want to go from IO output "1000" to "0100" i suspect that i can
> only
> realize this with the following steps:
>
> if the current output(binary) is 1000
> then the "extra step" outr(PIO_CODR, 0x80); (i don't want this, but i
> have
> to set bit to zero)
> result IO output: 0000
> then outr(PIO_SODR, 0x40);
> result IO output 0100
>
> is there a way to direcly go from output 1000 to 0100 ?
> i think that my display driver becomes confused about the extra IO state
>
>
> Greetings Paul
>
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list