fast bidirectional data bus

I’ve got a chip with a bidirectional parallel 8-bit data bus that
I’d like to read/write. It is similar to a static RAM interface
with a RD/ and a WR/ line for control. At the moment it seems I have
to set the pinMode() of each of the 8 data lines to either input
or output each time I want to switch between reading and writing.
This is very slow and cumbersome. Is it possible to define groups of pins
to be bidirectional and read/write faster?

Yes, they're called ports.
Trouble is, they're not always conveniently grouped.
The only eight-bit wide one on the Deumilanova is PortD, comprising digital pins 0 to 7.

On some of the surface-mount devices, PortC is also eight bits wide, but you then lose analogue inputs.

That is where the new Mega board could really shine with it's additional I/O ports and by using direct port access code (instead of single bit digital reads and writes) you should have no trouble supplying or receiving parallel data at high speeds. Use interrupt pins and routines for the handshaking control bits and you would have speed to spare for most any application.


OK, thanks guys. I'm using a Sanguino (ATMEGA644P),
and I have placed the 8 data lines on the port A pins.
The control signals are on the port C pins, and some
status signals are on port B. I am using all 24 pins. I'm
just wondering how you go about writing
port-i/o oriented code using the "processing" language -- or
should I just bite the bullet and switch over to using GCC-AVR

You can read or write directly to ports using the Arduino IDE. You just have to determine the port names for your 644 processor chip.


Lefty: Thanks, this is what I need. :slight_smile:

BTW, the chip I'm interfacing with is a Wiznet W5300. I saw (just now) that there is an ethernet shield that uses the Wiznet 5100. I will look and see if I can find the shield's Wiznet 5100 driver source code so I can
see how they talk to the chip.

The W5100 is accessed via SPI.