| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | //***************************************************************************** |
| 2 | // File Name : lcdtest.c |
||
| 3 | // |
||
| 4 | // Title : example usage of some avr library functions |
||
| 5 | // Revision : 1.0 |
||
| 6 | // Notes : |
||
| 7 | // Target MCU : Atmel AVR series |
||
| 8 | // Editor Tabs : 4 |
||
| 9 | // |
||
| 10 | // Revision History: |
||
| 11 | // When Who Description of change |
||
| 12 | // ----------- ----------- ----------------------- |
||
| 13 | // 30-Apr-2002 pstang Created the program |
||
| 14 | //***************************************************************************** |
||
| 15 | |||
| 16 | //----- Include Files --------------------------------------------------------- |
||
| 17 | #include <avr/io.h> // include I/O definitions (port names, pin names, etc) |
||
| 18 | #include <avr/interrupt.h> // include interrupt support |
||
| 19 | |||
| 20 | #include "global.h" // include our global settings |
||
| 21 | #include "uart.h" // include uart function library |
||
| 22 | #include "rprintf.h" // include printf function library |
||
| 23 | #include "a2d.h" // include A/D converter function library |
||
| 24 | #include "timer.h" // include timer function library (timing, PWM, etc) |
||
| 25 | #include "lcd.h" |
||
| 26 | |||
| 27 | //----- Begin Code ------------------------------------------------------------ |
||
| 28 | int main(void) |
||
| 29 | { |
||
| 30 | u08 a=0; |
||
| 31 | |||
| 32 | // initialize our libraries |
||
| 33 | // initialize the UART (serial port) |
||
| 34 | uartInit(); |
||
| 35 | // make all rprintf statements use uart for output |
||
| 36 | rprintfInit(uartSendByte); |
||
| 37 | // turn on and initialize A/D converter |
||
| 38 | a2dInit(); |
||
| 39 | // initialize the timer system |
||
| 40 | timerInit(); |
||
| 41 | // print a little intro message so we know things are working |
||
| 42 | rprintf("\r\nWelcome to AVRlib!\r\n"); |
||
| 43 | |||
| 44 | // initialize LCD |
||
| 45 | lcdInit(); |
||
| 46 | // direct printf output to LCD |
||
| 47 | rprintfInit(lcdDataWrite); |
||
| 48 | |||
| 49 | // print message on LCD |
||
| 50 | rprintf("Welcome to AVRlib!"); |
||
| 51 | |||
| 52 | DDRA = 0x00; |
||
| 53 | PORTA = 0x00; |
||
| 54 | |||
| 55 | // display a bargraph of the analog voltages on a2d channels 0,1 |
||
| 56 | while(1) |
||
| 57 | { |
||
| 58 | lcdGotoXY(0,0); |
||
| 59 | lcdProgressBar(a2dConvert8bit(0), 255, 20); |
||
| 60 | rprintf(" X: %d", a2dConvert8bit(0)); |
||
| 61 | rprintf(" Sample: %d", a++); |
||
| 62 | lcdGotoXY(0,1); |
||
| 63 | lcdProgressBar(a2dConvert8bit(1), 255, 20); |
||
| 64 | rprintf(" Y: %d", a2dConvert8bit(1)); |
||
| 65 | } |
||
| 66 | |||
| 67 | return 0; |
||
| 68 | } |
Powered by WebSVN v2.8.3