?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik //*****************************************************************************
2 // File Name : ads7870test.c
3 //
4 // Title : example usage of ADS7870 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 // 07-Jul-2005 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 "timer.h" // include timer function library (timing, PWM, etc)
24 #include "vt100.h" // include VT100 terminal support
25 #include "spi.h" // include spi support
26 #include "ads7870.h" // include ADS7828 support
27  
28 void ads7870test(void);
29  
30 //----- Begin Code ------------------------------------------------------------
31 int main(void)
32 {
33 // initialize our libraries
34 // initialize the UART (serial port)
35 uartInit();
36 uartSetBaudRate(115200);
37 // make all rprintf statements use uart for output
38 rprintfInit(uartSendByte);
39 // initialize the timer system
40 timerInit();
41 // clear terminal screen
42 vt100ClearScreen();
43 vt100SetCursorPos(1,1);
44 // print a little intro message so we know things are working
45 rprintf("\r\nWelcome to ADS7870 test!\r\n");
46  
47 // run tests
48 ads7870test();
49  
50 return 0;
51 }
52  
53 void ads7870test(void)
54 {
55 u08 i;
56 u16 conv=0;
57  
58 // initialize a/d converter
59 if(ads7870Init())
60 {
61 rprintf("ADS7870 detected and initialized!\r\n");
62 }
63 else
64 {
65 rprintf("Cannot detect ADS7870!\r\n");
66 return;
67 }
68  
69 while(1)
70 {
71 // position cursor
72 vt100SetCursorPos(4,1);
73  
74 for(i=0; i<8; i++)
75 {
76 // convert
77 conv = ads7870Convert(i);
78 // print results
79 rprintf("CH#%d: Conversion result is: %d \r\n", i, conv);
80 }
81 // pause between readings
82 timerPause(100);
83 }
84 }
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3