Minor formatting updates to the SerialToLCD project.
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 14 Apr 2012 21:47:02 +0000 (21:47 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 14 Apr 2012 21:47:02 +0000 (21:47 +0000)
Projects/SerialToLCD/Lib/HD44780.c
Projects/SerialToLCD/Lib/HD44780.h
Projects/SerialToLCD/SerialToLCD.c
Projects/SerialToLCD/SerialToLCD.txt

index d67dc6d..7bf989d 100644 (file)
@@ -83,11 +83,11 @@ static void HD44780_WriteByte(const uint8_t c)
 
 static void HD44780_PowerUp4Bit(void)
 {
 
 static void HD44780_PowerUp4Bit(void)
 {
-       /*  Wait for more than 40 ms after VCC rises to 2.7 V */
+       /* Wait for more than 40 ms after VCC rises to 2.7 V */
        _delay_ms(40);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
 
        _delay_ms(40);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
 
-       /*  Wait for more than 4.1 ms */
+       /* Wait for more than 4.1 ms */
        _delay_ms(5);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
        
        _delay_ms(5);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
        
@@ -95,12 +95,12 @@ static void HD44780_PowerUp4Bit(void)
        _delay_us(100);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
        
        _delay_us(100);
        HD44780_WriteNibble(0x03);        // FN_SET 8-bit
        
-       /*  From now on we must allow 40us for each command */
+       /* From now on we must allow 40us for each command */
        _delay_us(50);
        HD44780_WriteNibble(0x02);        // FN_SET 4-bit
 
        _delay_us(50);
        HD44780_WriteNibble(0x02);        // FN_SET 4-bit
 
-       /*  The LCD is now in 4-bit mode so we can continue
-               using the 4-bit API */
+       /* The LCD is now in 4-bit mode so we can continue
+          using the 4-bit API */
        _delay_us(50);
 }
 
        _delay_us(50);
 }
 
index a800ae7..680e69b 100644 (file)
                #include <avr/power.h>
 
        /* Macros: */
                #include <avr/power.h>
 
        /* Macros: */
-               #define RS                  (0x10)      // PD4
-               #define ENABLE              (0x80)      // PD7
+               #define RS                  (1 << 4)    /* PD4 */
+               #define ENABLE              (1 << 7)    /* PD7 */
 
 
-               #define HI4_MASK            (0xF0)
-               #define LO4_MASK            (0x0F)      // PD0..3
+               #define HI4_MASK            0xF0
+               #define LO4_MASK            0x0F        /* PD0-PD3 */
 
 
-               #define ALL_BITS            (RS|ENABLE|LO4_MASK)
+               #define ALL_BITS            (RS | ENABLE | LO4_MASK)
 
 
-               #define HI4( c )            (( c & HI4_MASK ) >> 4 )
-               #define LO4( c )            (( c & LO4_MASK ) >> 0 )
+               #define HI4(c)              ((c & HI4_MASK) >> 4)
+               #define LO4(c)              ((c & LO4_MASK) >> 0)
 
                #define CMD_DISPLAY_ON      0x0C
 
 
                #define CMD_DISPLAY_ON      0x0C
 
index 7a28927..59522b3 100644 (file)
  *
  *  Main source file for the SerialToLCD program. This file contains the main tasks of
  *  the project and is responsible for the initial application hardware configuration.
  *
  *  Main source file for the SerialToLCD program. This file contains the main tasks of
  *  the project and is responsible for the initial application hardware configuration.
- *    
- *  \section Hardware Information
- *
- *    LCD Datasheet:  See http://www.sparkfun.com/datasheets/LCD/HD44780.pdf
- *   
- *   Also see the two articles from EPE which are linked from here:
- *   http://en.wikipedia.org/wiki/HD44780_Character_LCD
- *
- *   Connections from the Minimus to the HD44780 as shown below.
- *   
- *   =========================================================  \n
- *   Minimus                 HD44780     Pin                    \n
- *   =========================================================  \n
- *   PD0                     DB4         11                     \n
- *   PD1                     DB5         12                     \n
- *   PD2                     DB6         13                     \n
- *   PD3                     DB7         14                     \n
- *                                                              \n
- *   PD4                     RS          4                      \n
- *                           RW          5       GND            \n
- *   PD7                     EN          6                      \n
- *                                                              \n
- *                                       1       GND            \n
- *                                       2       USB +5V        \n
- *                                       3       2k -> GND      \n
  */
 
 #include "SerialToLCD.h"
  */
 
 #include "SerialToLCD.h"
index 8bf2102..84237b4 100644 (file)
  *  designed to use the Minimum USB AVR board, however it can be modified to suit other hardware\r
  *  if desired.\r
  *\r
  *  designed to use the Minimum USB AVR board, however it can be modified to suit other hardware\r
  *  if desired.\r
  *\r
- *  See comments in the SerialToLCD.c source file for hardware pinouts of the Minimus board.\r
+ *  LCD Datasheet:    http://www.sparkfun.com/datasheets/LCD/HD44780.pdf \n\r
+ *  More Information: http://en.wikipedia.org/wiki/HD44780_Character_LCD \n\r
+ *\r
+ *  Below are the connections between the AVR Minimus board and LCD.\r
+ *\r
+ *  <table>\r
+ *   <tr>\r
+ *    <td><b>AVR Pin:</b></td>\r
+ *    <td><b>HD44780 LCD Pin:</b></td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>VCC</td>\r
+ *    <td>VCC</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>GND</td>\r
+ *    <td>GND</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD0</td>\r
+ *    <td>DB4</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD1</td>\r
+ *    <td>DB5</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD2</td>\r
+ *    <td>DB6</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD3</td>\r
+ *    <td>DB7</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD4</td>\r
+ *    <td>/RS</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>GND</td>\r
+ *    <td>/RW</td>\r
+ *   </tr>\r
+ *   <tr>\r
+ *    <td>PD7</td>\r
+ *    <td>/E</td>\r
+ *   </tr>\r
+ *  </table>\r
  */\r
  */\r