1 /*********************************************
2 * vim: set sw=8 ts=8 si :
3 * Author: Guido Socher, Copyright: GPL
4 * This is a test program which will write "LCD works"
6 * This program is also used to test the keypad. It
7 * displays the button last pressed.
9 * See http://www.tuxgraphics.org/electronics/
12 * Clock frequency : Internal clock 8 Mhz
13 *********************************************/
16 #define F_CPU 8000000UL // 8 MHz
17 #include <util/delay.h>
25 // set output to VCC, red LED off
26 #define LEDOFF PORTD|=(1<<PORTD0)
27 // set output to GND, red LED on
28 #define LEDON PORTD&=~(1<<PORTD0)
29 // to test the state of the LED
30 #define LEDISOFF PORTD&(1<<PORTD0)
32 void delay_ms(uint16_t ms)
33 /* delay for a minimum of <ms> */
35 // we use a calibrated macro. This is more
36 // accurate and not so much compiler dependent
51 DDRD|= (1<<DDD0); // LED, enable PD0, LED as output
56 lcd_puts("use U+/U-");
58 lcd_puts("and store");
72 dac_val=0xFFF; //max, 13bit
78 itoa(dac_val,out_buf,10);
98 if (check_store_button()){
105 check_u_button(&cnt);
120 if (check_store_button()){