Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ Electronics ➜ Microprocessors ➜ Parallel Peripheral Interface - for Arduino

Parallel Peripheral Interface - for Arduino

Postings by administrators only.

Refresh page


Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Sat 29 Jan 2011 03:28 AM (UTC)

Amended on Mon 07 Feb 2011 04:49 AM (UTC) by Nick Gammon

Message
This post describes how "parallel" interfaces work, with particular reference to the Arduino Uno which is based on the ATmega328P microprocessor chip. A lot of the details however will be of more general interest.



More information about Parallel Ports at:

http://en.wikipedia.org/wiki/Parallel_port


More information about connecting an Arduino to an LCD display by a parallel interface is at:

http://arduino.cc/en/Tutorial/LiquidCrystal

Unlike the other protocols described below, the parallel interface sends all of the bits "in parallel" (ie. at once) rather than "serially" (ie. one after the other).

The LCD example below is actually a bit of both, as in order to save using 10 pins (that is, most of them) from your Arduino just to drive an LCD display, the Hitachi Dot Matrix LCD driver lets you break the 8 bits up into two groups of 4. So really, it is a parallel port, but with two of them serially, to get 8 bits of data.

Other protocols





Clocking data out


The parallel interface is rather simple, compared to some of the other interfaces mentioned above.



Basically the processor sets up the required bits, and then "clocks" them out by briefly raising the EN (enable) line. The EN line is otherwise known as a "strobe" or "clock" line, because it is used to tell the "receiving" end that the data bits are now available to be read.

The graphic also shows a RS line (register select) which is used by this particular chip to control whether you are sending instructions (eg. moving the cursor, blanking the screen) or data (in which case the 8 bits are just the byte you want displayed).

You can see from the staggered way that DB4 (data bit 4) through to DB7 (data bit 7) are raised high, that the processor is clearly starting with bit 4, then bit 5, then bit 6, then bit 7, and then finally raising EN (enable) and then dropping it again.

The blue lines helps you to see exactly the values of the 4 data lines at the moment that the EN line is pulsed.

Since this LCD lets you use 4-bit data, each ASCII character is pulsed out in pairs of 4 bits. The high-order bits are first (in the case of the letter "H" it starts with 0100 and then 1000. Assembled this gives 01001000 which is 0x48, namely "H".

Then the letters "e", "a", and "l" are sent. In fact, this is sending the word "Health" which is part of an RPG game for an Arduino which is under development.

Timing


The time between the "H" and "e" is 360 microseconds, which means we can send data at the rate of 2777 characters per second.

History


Parallel interfaces used to be very popular (eg. Centronics printer interfaces) because they were fast (a few decades ago) compared to the comparatively slow serial rates achievable at the time.

However they have fallen out of favour more recently, because of the large number of wires needed. Historically parallel interfaces needed something like the following:


  • 8 data wires
  • Ground return
  • Strobe (or "clock") which tells the printer the data is ready
  • ACK (acknowledge), where the printer acknowledges the data
  • Busy - the printer is busy right now
  • Out of paper - the printer is out of paper
  • Other wires for special purposes


That's a lot of wires, compared to using a serial interface. There were also problems with capacitance in the cable over long cable runs, which meant that attempting to send data too quickly might cause "phantom" bits to appear in adjacent wires.

Even with microprocessors like the Arduino, dedicating 8 or 9 pins just for driving a parallel interface tends to use up most of the ports available.

Hence these days the move towards other interfaces, including I2C, which only requires two wires (plus ground) and can be shared between multiple peripherals.

Port Expanders


In order to interface with parallel devices you can choose to use port expanders like the Microchip MCP23017. This sells for around $US 1.20 each, has an I2C interface for hooking up to your processor, and then 16 ports to drive peripherals (like LCD displays). This keeps the wire count down in cases where peripherals themselves don't support I2C, SPI, or similar.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,078 views.

Postings by administrators only.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.