consecutive port pins

Questions on other types of hardware and getting it talking to the ARM CPU
Post Reply
basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

consecutive port pins

Post by basicchip »

>from the help line
>I'm trying to write to a port with consecutive port pins, so I selected port 2, with pins 2.0 to 2.9 available. But now I find I need one more pin. Can I use P2.10? I see it's marked 'boot', but after I've booted into 'C', is that pin available?

Yes you can output on port 2.10



danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: consecutive port pins

Post by danlee58 »

i need to set 7 IO pins LOW, so I can set 1 of the 7 HIGH. Can I write to 7 IO pins in one instruction, or do I have to do each individually? Five pins are Port0, one is Port1, and one is Port 2.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: consecutive port pins

Post by basicchip »

As they are on 3 different ports that would require at least 3 different writes, so they will not happen at exactly the same time (depending on the device about 50 nsec apart), so if you are controlling motors you would want to "break before make", in other words set all to 0, then set the desired bit high.

The 32 bit GPIO pins per port can be controlled by SET or CLEAR registers (the way I normally do it, writing 1 in a bit sets or clears, writing 0 has no effect). Or you can use mask bits and then write the corresponding value to the pin register.

Post Reply