I'm planning to use a 2560 board to multiplex 40-50 switches in a machine control panel to an emc2 controller via modbus. Scanning this number of inputs will be much more efficient if done as parallel operations, via port manipulations, rather than as single bits. Even the 2560 doesn't provide enough uncommitted dio pins, so I will need to use some of the ports that have been assigned to other uses (analog in, for example). I haven't been able to find in the documentation, either Arduino or AVR, what process, if any, is needed to set the operating mode of a port to either general digital i/o or special purpose. Can someone clarify this?
On a somewhat related note, I have been searching for definitions of the port manipulation registers (DDR etc) for the 2560 board. A previous post on this board provided:
for your ATMega 2560 controller, you can find the information in file "C:\arduino-0022\hardware\tools\avr\avr\include\avr\iomxx0_1.h". So there's no need to define the register names yourself.
my installation of arduino-0022 (on ubuntu 10.04) shows nothing in the tools directory but arvdude. Anybody have an idea where the rest of the data went?
thanks in advance