Arduino openGLCD Library Version v1.0rc2 |

All Classes Functions Variables Enumerations Enumerator Groups Pages
Specifying Pins

Pins can be specified by Arduino pin number or by AVR port and pin/bit number.

The syntax used for specifying Arduino pin number is:

#define glcdpinCSEL1 14 //example of using Arduino pin number

The syntax used for AVR port and pin number is PIN_Pb where Pb represents a PORT and a bit#.
For example, to specify port C bit 0 you would use PIN_C0 The following sets glcdpinCSEL1 (the first chip select) to port C bit 0 which is the same as arduino digital pin 14 on a m328 processor.

#define glcdpinCSEL1 PIN_C0 //example of using AVR Port and bit number

There are no restristions as to which Arduino/AVR pins are used. Any Arduino/AVR pin on any port can be used for any glcd function. Simply specify the pin and at compile time, the code will automagically figure out the best possible mode for the configured pins and generate the smallest/fastest code including single instructions when possible. If all the data pins are on the same AVR port and in the proper order, byte mode will be used, if pins span ports but are are sequential and nibble aligned, then nibble mode will be used. The code will drop down to individual bit i/o if necessary. The code is even smart enough to use nibble mode for one nibble an then bit i/o for the other bits in the data byte.

While the code does support any Arduino/AVR pin for any glcd function, if pins are grouped appropriately on the AVR ports, the code can take advantage of byte or nibble mode to offer a potential performance increase.

Note
  See the avrio.h file for more details.