-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.c
85 lines (78 loc) · 1.76 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* ---------------------------------------------------+
* @desc Main file
* ---------------------------------------------------+
* @copyright Copyright (C) 2020 Marian Hrinko.
* @author Marian Hrinko
* @email mato.hrinko@gmail.com
* @datum 10.11.2020
* @update 15.04.2021
* @file main.c
* @version 1.0
* @tested AVR Atmega16a
* ---------------------------------------------------+
*/
// include libraries
#include <util/delay.h>
#include "lib/hd44780.h"
/**
* @desc Main function
*
* @param void
* @return int
*/
int main (void)
{
// init diplay in 4 bit mode
HD44780_Init();
// DISPALY ON
// --------------------------
// display clear
HD44780_DisplayClear();
// set position
HD44780_PositionXY(0, 0);
// send char
HD44780_DrawString("DISPLAY ON");
// display clear
HD44780_DisplayOn();
// delay
_delay_ms(2000);
// CURSOR ON & DISPLAY ON
// --------------------------
// display clear
HD44780_DisplayClear();
// set position
HD44780_PositionXY(0, 0);
// send char
HD44780_DrawString("CURSOR ON");
// cursor on
HD44780_CursorOn();
// delay
_delay_ms(2000);
// CURSOR BLINK & DISPLAY ON
// --------------------------
// display clear
HD44780_DisplayClear();
// set position
HD44780_PositionXY(0, 0);
// send char
HD44780_DrawString("CURSOR BLINK");
// delay
HD44780_CursorBlink();
// delay
_delay_ms(2000);
// CURSOR OFF & DISPLAY ON
// --------------------------
// display clear
HD44780_DisplayClear();
// set position
HD44780_PositionXY(0, 0);
// send char
HD44780_DrawString("CURSOR OFF");
// delay
HD44780_CursorOff();
// EXIT
// -------------------------------------------------
// return & exit
return 0;
}