No changes between revisions
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/LCD_zkouska.aps
0,0 → 1,0
<AVRStudio><MANAGEMENT><ProjectName>LCD_zkouska</ProjectName><Created>21-Nov-2011 21:14:11</Created><LastEdit>21-Nov-2011 21:22:19</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>21-Nov-2011 21:14:11</Created><Version>4</Version><Build>4, 18, 0, 685</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\LCD_zkouska.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Users\Honza\Documents\c\LCD_zkouska\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>ICE50</CURRENT_TARGET><CURRENT_PART>ATmega8.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>LCD_zkouska.c</SOURCEFILE><OTHERFILE>default\LCD_zkouska.lss</OTHERFILE><OTHERFILE>default\LCD_zkouska.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega8</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>LCD_zkouska.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>LCD_zkouska.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>c:\winavr-20100110\avr\include\util\delay.h</FileName><Status>1</Status></File00001></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/LCD_zkouska.c
0,0 → 1,62
//Program pro vyzkouseni funkcnosti modulu s LCD a mikropocitacem ATmega8
//MLAB 21.11.2011 (JACHO)
 
//vytvoreno v programu AVR studio 4
 
#include <avr/io.h>
#include <stdio.h>
#include <avr/iom8.h>
#include "lcd.h"
#include "lcd.c"
#include <util/delay.h>
 
 
#define MAXDISPLBUFFER 20 //buffer pro lcd display
 
 
//-----------------------------------------------------------------------------
 
int main(void)
{
LCD_init(); //Inicializace LCD
 
char zasobnik[19];
 
sprintf(zasobnik,"LCD je OK"); //vlozi text do zasobnik
LCD_gotoxy(0,0); //definuje kam se zacne zapisovat na LCD
ProcesDispl(zasobnik);
LCD_gotoxy(0,2);
ProcesDispl(zasobnik);
_delay_ms(1);
 
 
return 0;
 
 
 
}
 
void ProcesDispl(char *data) //zajišuje tisk øetìzce na lcd
{
uint8_t a,b;
 
for (a=0;a<MAXDISPLBUFFER;a++)
{
switch (*(data+a))
{
case 0: *data = 0;return;
case '\n': LCD_gotoxy(1,2);break; //posun na druhej øádek
case '\r': LCD_gotoxy(1,1);break;
case '\a': LCD_gotoxy(6,2);break; //posun na 2.øádek 6.políèko
case '\f': LCD_gotoxy(1,1);
for (b=0;b<8;b++) LCD_putc(0x20);
LCD_gotoxy(1,2);
for (b=0;b<8;b++) LCD_putc(0x20);
LCD_gotoxy(1,1);
break;
default : LCD_putc(*(data+a));
}
}
*data = 0;
}
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/LCD_zkouska.eep
0,0 → 1,0
:00000001FF
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/LCD_zkouska.elf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/LCD_zkouska.hex
0,0 → 1,38
:1000000014C026C025C024C023C022C021C020C0E7
:100010001FC01EC01DC01CC01BC01AC019C018C004
:1000200017C016C015C0280C010611241FBECFE54D
:10003000D4E0DEBFCDBF10E0A0E6B0E0E2E3F2E046
:1000400002C005900D92AA36B107D9F7BAD0EFC019
:10005000D7CFA39ABC9ABD9ABB9AB99ABA9A089577
:10006000AB98C498C598C39880FDAB9A81FDC49A9B
:1000700082FDC59A83FDC39AC19A81E08A95F1F702
:10008000C19808951F93182F82958F70E9DF812FF3
:10009000E7DF8DE08A95F1F71F910895C29AF2DFAC
:1000A0000895FCDF0895C298EDDFC29A08950F937A
:1000B0001F93CF93DF93CDDF88E893E10197F1F7AA
:1000C000C198C29804EF11E0C8010197F1F783E0ED
:1000D000C7DFC8010197F1F783E0C2DFC8010197CC
:1000E000F1F783E0BDDF1DE0812F8A95F1F782E013
:1000F000B7DF1A95F1F706E210E0C4EFD1E0F8019E
:100100008491D1DFCE010197F1F70F5F1F4FF0E02F
:1001100009321F07A1F7DF91CF911F910F91089529
:1001200081E0C1DF84EF91E00197F1F708958150FC
:10013000623009F4805C8068B6DF0895EF92FF9228
:100140001F93CF93DF937C01C0E0D0E0F701EC0F69
:10015000FD1F80818A3061F08B3028F4882349F1BB
:10016000873011F50BC08C3061F08D30E9F402C09E
:1001700081E005C081E061E0DADF17C086E062E07F
:10018000FBCF81E061E0D3DF10E080E287DF1F5F1B
:100190001830D9F781E062E0CADF10E080E27EDF4C
:1001A0001F5F1830D9F7E6CF79DF2196C431D1052A
:1001B00069F6F7011082DF91CF911F91FF90EF90C8
:1001C00008950F931F93DF93CF93CDB7DEB7639757
:1001D0000FB6F894DEBF0FBECDBF69DF8E010F5F93
:1001E0001F4FC80160E670E01BD080E060E09FDF39
:1001F000C801A4DF80E062E09ADFC8019FDF8AEFD8
:1002000090E00197F1F780E090E063960FB6F894E4
:10021000DEBF0FBECDBFCF91DF911F910F9108952B
:10022000FB01DC0101900D920020E1F70895F894A4
:02023000FFCFFE
:0A0232004C4344206A65204F4B0046
:00000001FF
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/LCD_zkouska.lss
0,0 → 1,550
 
LCD_zkouska.elf: file format elf32-avr
 
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000232 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 0000000a 00800060 00000232 000002a6 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .debug_aranges 00000020 00000000 00000000 000002b0 2**0
CONTENTS, READONLY, DEBUGGING
3 .debug_pubnames 000000d2 00000000 00000000 000002d0 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000577 00000000 00000000 000003a2 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 000001da 00000000 00000000 00000919 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 00000413 00000000 00000000 00000af3 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 000000c0 00000000 00000000 00000f08 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 00000192 00000000 00000000 00000fc8 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 0000017f 00000000 00000000 0000115a 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 000000a8 00000000 00000000 000012d9 2**0
CONTENTS, READONLY, DEBUGGING
 
Disassembly of section .text:
 
00000000 <__vectors>:
0: 14 c0 rjmp .+40 ; 0x2a <__ctors_end>
2: 26 c0 rjmp .+76 ; 0x50 <__bad_interrupt>
4: 25 c0 rjmp .+74 ; 0x50 <__bad_interrupt>
6: 24 c0 rjmp .+72 ; 0x50 <__bad_interrupt>
8: 23 c0 rjmp .+70 ; 0x50 <__bad_interrupt>
a: 22 c0 rjmp .+68 ; 0x50 <__bad_interrupt>
c: 21 c0 rjmp .+66 ; 0x50 <__bad_interrupt>
e: 20 c0 rjmp .+64 ; 0x50 <__bad_interrupt>
10: 1f c0 rjmp .+62 ; 0x50 <__bad_interrupt>
12: 1e c0 rjmp .+60 ; 0x50 <__bad_interrupt>
14: 1d c0 rjmp .+58 ; 0x50 <__bad_interrupt>
16: 1c c0 rjmp .+56 ; 0x50 <__bad_interrupt>
18: 1b c0 rjmp .+54 ; 0x50 <__bad_interrupt>
1a: 1a c0 rjmp .+52 ; 0x50 <__bad_interrupt>
1c: 19 c0 rjmp .+50 ; 0x50 <__bad_interrupt>
1e: 18 c0 rjmp .+48 ; 0x50 <__bad_interrupt>
20: 17 c0 rjmp .+46 ; 0x50 <__bad_interrupt>
22: 16 c0 rjmp .+44 ; 0x50 <__bad_interrupt>
24: 15 c0 rjmp .+42 ; 0x50 <__bad_interrupt>
 
00000026 <LCD_INIT_STRING>:
26: 28 0c 01 06 (...
 
0000002a <__ctors_end>:
2a: 11 24 eor r1, r1
2c: 1f be out 0x3f, r1 ; 63
2e: cf e5 ldi r28, 0x5F ; 95
30: d4 e0 ldi r29, 0x04 ; 4
32: de bf out 0x3e, r29 ; 62
34: cd bf out 0x3d, r28 ; 61
 
00000036 <__do_copy_data>:
36: 10 e0 ldi r17, 0x00 ; 0
38: a0 e6 ldi r26, 0x60 ; 96
3a: b0 e0 ldi r27, 0x00 ; 0
3c: e2 e3 ldi r30, 0x32 ; 50
3e: f2 e0 ldi r31, 0x02 ; 2
40: 02 c0 rjmp .+4 ; 0x46 <.do_copy_data_start>
 
00000042 <.do_copy_data_loop>:
42: 05 90 lpm r0, Z+
44: 0d 92 st X+, r0
 
00000046 <.do_copy_data_start>:
46: aa 36 cpi r26, 0x6A ; 106
48: b1 07 cpc r27, r17
4a: d9 f7 brne .-10 ; 0x42 <.do_copy_data_loop>
4c: ba d0 rcall .+372 ; 0x1c2 <main>
4e: ef c0 rjmp .+478 ; 0x22e <_exit>
 
00000050 <__bad_interrupt>:
50: d7 cf rjmp .-82 ; 0x0 <__vectors>
 
00000052 <LCD_init_IO_PIN>:
0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
};
 
void LCD_init_IO_PIN(void)
{
DDR_D0 |= _BV(PIN_D0);
52: a3 9a sbi 0x14, 3 ; 20
DDR_D1 |= _BV(PIN_D1);
54: bc 9a sbi 0x17, 4 ; 23
DDR_D2 |= _BV(PIN_D2);
56: bd 9a sbi 0x17, 5 ; 23
DDR_D3 |= _BV(PIN_D3);
58: bb 9a sbi 0x17, 3 ; 23
DDR_E |= _BV(PIN_E);
5a: b9 9a sbi 0x17, 1 ; 23
DDR_RS |= _BV(PIN_RS);
5c: ba 9a sbi 0x17, 2 ; 23
}
5e: 08 95 ret
 
00000060 <LCD_send_nibble>:
_delay_us(40);
}
 
void LCD_send_nibble(uint8_t data)
{
L_D0;L_D1;L_D2;L_D3;
60: ab 98 cbi 0x15, 3 ; 21
62: c4 98 cbi 0x18, 4 ; 24
64: c5 98 cbi 0x18, 5 ; 24
66: c3 98 cbi 0x18, 3 ; 24
if (data & 0x1) H_D0;
68: 80 fd sbrc r24, 0
6a: ab 9a sbi 0x15, 3 ; 21
if (data & 0x2) H_D1;
6c: 81 fd sbrc r24, 1
6e: c4 9a sbi 0x18, 4 ; 24
if (data & 0x4) H_D2;
70: 82 fd sbrc r24, 2
72: c5 9a sbi 0x18, 5 ; 24
if (data & 0x8) H_D3;
74: 83 fd sbrc r24, 3
76: c3 9a sbi 0x18, 3 ; 24
H_E;
78: c1 9a sbi 0x18, 1 ; 24
can be achieved.
*/
void
_delay_loop_1(uint8_t __count)
{
__asm__ volatile (
7a: 81 e0 ldi r24, 0x01 ; 1
7c: 8a 95 dec r24
7e: f1 f7 brne .-4 ; 0x7c <LCD_send_nibble+0x1c>
_delay_us(1);
L_E;
80: c1 98 cbi 0x18, 1 ; 24
}
82: 08 95 ret
 
00000084 <LCD_send>:
H_RS;
LCD_send(data);
}
 
void LCD_send(uint8_t data)
{
84: 1f 93 push r17
86: 18 2f mov r17, r24
LCD_send_nibble(data >> 4);
88: 82 95 swap r24
8a: 8f 70 andi r24, 0x0F ; 15
8c: e9 df rcall .-46 ; 0x60 <LCD_send_nibble>
LCD_send_nibble(data);
8e: 81 2f mov r24, r17
90: e7 df rcall .-50 ; 0x60 <LCD_send_nibble>
92: 8d e0 ldi r24, 0x0D ; 13
94: 8a 95 dec r24
96: f1 f7 brne .-4 ; 0x94 <LCD_send+0x10>
_delay_us(40);
}
98: 1f 91 pop r17
9a: 08 95 ret
 
0000009c <LCD_send_data>:
H_RS;
}
 
void LCD_send_data(uint8_t data)
{
H_RS;
9c: c2 9a sbi 0x18, 2 ; 24
LCD_send(data);
9e: f2 df rcall .-28 ; 0x84 <LCD_send>
}
a0: 08 95 ret
 
000000a2 <LCD_putc>:
}
}
 
void LCD_putc(uint8_t data)
{
LCD_send_data(data);
a2: fc df rcall .-8 ; 0x9c <LCD_send_data>
}
a4: 08 95 ret
 
000000a6 <LCD_send_command>:
 
void LCD_send_command(uint8_t data)
{
L_RS;
a6: c2 98 cbi 0x18, 2 ; 24
LCD_send(data);
a8: ed df rcall .-38 ; 0x84 <LCD_send>
H_RS;
aa: c2 9a sbi 0x18, 2 ; 24
}
ac: 08 95 ret
 
000000ae <LCD_init>:
DDR_E |= _BV(PIN_E);
DDR_RS |= _BV(PIN_RS);
}
 
void LCD_init(void)
{
ae: 0f 93 push r16
b0: 1f 93 push r17
b2: cf 93 push r28
b4: df 93 push r29
uint8_t a;
 
LCD_init_IO_PIN();
b6: cd df rcall .-102 ; 0x52 <LCD_init_IO_PIN>
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
b8: 88 e8 ldi r24, 0x88 ; 136
ba: 93 e1 ldi r25, 0x13 ; 19
bc: 01 97 sbiw r24, 0x01 ; 1
be: f1 f7 brne .-4 ; 0xbc <LCD_init+0xe>
_delay_ms(20);
L_E;
c0: c1 98 cbi 0x18, 1 ; 24
L_RS;
c2: c2 98 cbi 0x18, 2 ; 24
c4: 04 ef ldi r16, 0xF4 ; 244
c6: 11 e0 ldi r17, 0x01 ; 1
c8: c8 01 movw r24, r16
ca: 01 97 sbiw r24, 0x01 ; 1
cc: f1 f7 brne .-4 ; 0xca <LCD_init+0x1c>
for (a=0;a<3;a++)
{
_delay_ms(2);
LCD_send_nibble(0x3);
ce: 83 e0 ldi r24, 0x03 ; 3
d0: c7 df rcall .-114 ; 0x60 <LCD_send_nibble>
d2: c8 01 movw r24, r16
d4: 01 97 sbiw r24, 0x01 ; 1
d6: f1 f7 brne .-4 ; 0xd4 <LCD_init+0x26>
d8: 83 e0 ldi r24, 0x03 ; 3
da: c2 df rcall .-124 ; 0x60 <LCD_send_nibble>
dc: c8 01 movw r24, r16
de: 01 97 sbiw r24, 0x01 ; 1
e0: f1 f7 brne .-4 ; 0xde <LCD_init+0x30>
e2: 83 e0 ldi r24, 0x03 ; 3
e4: bd df rcall .-134 ; 0x60 <LCD_send_nibble>
can be achieved.
*/
void
_delay_loop_1(uint8_t __count)
{
__asm__ volatile (
e6: 1d e0 ldi r17, 0x0D ; 13
e8: 81 2f mov r24, r17
ea: 8a 95 dec r24
ec: f1 f7 brne .-4 ; 0xea <LCD_init+0x3c>
}
_delay_us(40);
LCD_send_nibble(0x2);
ee: 82 e0 ldi r24, 0x02 ; 2
f0: b7 df rcall .-146 ; 0x60 <LCD_send_nibble>
f2: 1a 95 dec r17
f4: f1 f7 brne .-4 ; 0xf2 <LCD_init+0x44>
f6: 06 e2 ldi r16, 0x26 ; 38
f8: 10 e0 ldi r17, 0x00 ; 0
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
fa: c4 ef ldi r28, 0xF4 ; 244
fc: d1 e0 ldi r29, 0x01 ; 1
_delay_us(40);
for (a=0;a<3;a++)
{
LCD_send_command(pgm_read_byte(&(LCD_INIT_STRING[a])));
fe: f8 01 movw r30, r16
100: 84 91 lpm r24, Z+
102: d1 df rcall .-94 ; 0xa6 <LCD_send_command>
104: ce 01 movw r24, r28
106: 01 97 sbiw r24, 0x01 ; 1
108: f1 f7 brne .-4 ; 0x106 <LCD_init+0x58>
10a: 0f 5f subi r16, 0xFF ; 255
10c: 1f 4f sbci r17, 0xFF ; 255
}
_delay_us(40);
LCD_send_nibble(0x2);
_delay_us(40);
for (a=0;a<3;a++)
10e: f0 e0 ldi r31, 0x00 ; 0
110: 09 32 cpi r16, 0x29 ; 41
112: 1f 07 cpc r17, r31
114: a1 f7 brne .-24 ; 0xfe <LCD_init+0x50>
{
LCD_send_command(pgm_read_byte(&(LCD_INIT_STRING[a])));
_delay_ms(2);
}
}
116: df 91 pop r29
118: cf 91 pop r28
11a: 1f 91 pop r17
11c: 0f 91 pop r16
11e: 08 95 ret
 
00000120 <LCD_clear>:
}
 
 
void LCD_clear(void)
{
LCD_send_command(1);
120: 81 e0 ldi r24, 0x01 ; 1
122: c1 df rcall .-126 ; 0xa6 <LCD_send_command>
124: 84 ef ldi r24, 0xF4 ; 244
126: 91 e0 ldi r25, 0x01 ; 1
128: 01 97 sbiw r24, 0x01 ; 1
12a: f1 f7 brne .-4 ; 0x128 <LCD_clear+0x8>
_delay_ms(2);
}
12c: 08 95 ret
 
0000012e <LCD_gotoxy>:
 
void LCD_gotoxy( uint8_t x, uint8_t y)
{
uint8_t Adr;
 
Adr=x-1;
12e: 81 50 subi r24, 0x01 ; 1
if(y==2)
130: 62 30 cpi r22, 0x02 ; 2
132: 09 f4 brne .+2 ; 0x136 <LCD_gotoxy+0x8>
Adr+=LCD_LINE_2;
134: 80 5c subi r24, 0xC0 ; 192
 
LCD_send_command(0x80|Adr);
136: 80 68 ori r24, 0x80 ; 128
138: b6 df rcall .-148 ; 0xa6 <LCD_send_command>
}
13a: 08 95 ret
 
0000013c <ProcesDispl>:
 
}
 
 
void ProcesDispl(char *data) //zajišuje tisk øetìzce na lcd
{
13c: ef 92 push r14
13e: ff 92 push r15
140: 1f 93 push r17
142: cf 93 push r28
144: df 93 push r29
146: 7c 01 movw r14, r24
148: c0 e0 ldi r28, 0x00 ; 0
14a: d0 e0 ldi r29, 0x00 ; 0
uint8_t a,b;
 
for (a=0;a<MAXDISPLBUFFER;a++)
{
switch (*(data+a))
14c: f7 01 movw r30, r14
14e: ec 0f add r30, r28
150: fd 1f adc r31, r29
152: 80 81 ld r24, Z
154: 8a 30 cpi r24, 0x0A ; 10
156: 61 f0 breq .+24 ; 0x170 <ProcesDispl+0x34>
158: 8b 30 cpi r24, 0x0B ; 11
15a: 28 f4 brcc .+10 ; 0x166 <ProcesDispl+0x2a>
15c: 88 23 and r24, r24
15e: 49 f1 breq .+82 ; 0x1b2 <ProcesDispl+0x76>
160: 87 30 cpi r24, 0x07 ; 7
162: 11 f5 brne .+68 ; 0x1a8 <ProcesDispl+0x6c>
164: 0b c0 rjmp .+22 ; 0x17c <ProcesDispl+0x40>
166: 8c 30 cpi r24, 0x0C ; 12
168: 61 f0 breq .+24 ; 0x182 <ProcesDispl+0x46>
16a: 8d 30 cpi r24, 0x0D ; 13
16c: e9 f4 brne .+58 ; 0x1a8 <ProcesDispl+0x6c>
16e: 02 c0 rjmp .+4 ; 0x174 <ProcesDispl+0x38>
{
case 0: *data = 0;return;
case '\n': LCD_gotoxy(1,2);break; //posun na druhej øádek
170: 81 e0 ldi r24, 0x01 ; 1
172: 05 c0 rjmp .+10 ; 0x17e <ProcesDispl+0x42>
case '\r': LCD_gotoxy(1,1);break;
174: 81 e0 ldi r24, 0x01 ; 1
176: 61 e0 ldi r22, 0x01 ; 1
178: da df rcall .-76 ; 0x12e <LCD_gotoxy>
17a: 17 c0 rjmp .+46 ; 0x1aa <ProcesDispl+0x6e>
case '\a': LCD_gotoxy(6,2);break; //posun na 2.øádek 6.políèko
17c: 86 e0 ldi r24, 0x06 ; 6
17e: 62 e0 ldi r22, 0x02 ; 2
180: fb cf rjmp .-10 ; 0x178 <ProcesDispl+0x3c>
case '\f': LCD_gotoxy(1,1);
182: 81 e0 ldi r24, 0x01 ; 1
184: 61 e0 ldi r22, 0x01 ; 1
186: d3 df rcall .-90 ; 0x12e <LCD_gotoxy>
188: 10 e0 ldi r17, 0x00 ; 0
}
}
 
void LCD_putc(uint8_t data)
{
LCD_send_data(data);
18a: 80 e2 ldi r24, 0x20 ; 32
18c: 87 df rcall .-242 ; 0x9c <LCD_send_data>
for (b=0;b<8;b++) LCD_putc(0x20);
18e: 1f 5f subi r17, 0xFF ; 255
190: 18 30 cpi r17, 0x08 ; 8
192: d9 f7 brne .-10 ; 0x18a <ProcesDispl+0x4e>
LCD_gotoxy(1,2);
194: 81 e0 ldi r24, 0x01 ; 1
196: 62 e0 ldi r22, 0x02 ; 2
198: ca df rcall .-108 ; 0x12e <LCD_gotoxy>
19a: 10 e0 ldi r17, 0x00 ; 0
19c: 80 e2 ldi r24, 0x20 ; 32
19e: 7e df rcall .-260 ; 0x9c <LCD_send_data>
for (b=0;b<8;b++) LCD_putc(0x20);
1a0: 1f 5f subi r17, 0xFF ; 255
1a2: 18 30 cpi r17, 0x08 ; 8
1a4: d9 f7 brne .-10 ; 0x19c <ProcesDispl+0x60>
1a6: e6 cf rjmp .-52 ; 0x174 <ProcesDispl+0x38>
1a8: 79 df rcall .-270 ; 0x9c <LCD_send_data>
1aa: 21 96 adiw r28, 0x01 ; 1
 
void ProcesDispl(char *data) //zajišuje tisk øetìzce na lcd
{
uint8_t a,b;
 
for (a=0;a<MAXDISPLBUFFER;a++)
1ac: c4 31 cpi r28, 0x14 ; 20
1ae: d1 05 cpc r29, r1
1b0: 69 f6 brne .-102 ; 0x14c <ProcesDispl+0x10>
LCD_gotoxy(1,1);
break;
default : LCD_putc(*(data+a));
}
}
*data = 0;
1b2: f7 01 movw r30, r14
1b4: 10 82 st Z, r1
}
1b6: df 91 pop r29
1b8: cf 91 pop r28
1ba: 1f 91 pop r17
1bc: ff 90 pop r15
1be: ef 90 pop r14
1c0: 08 95 ret
 
000001c2 <main>:
 
 
//-----------------------------------------------------------------------------
 
int main(void)
{
1c2: 0f 93 push r16
1c4: 1f 93 push r17
1c6: df 93 push r29
1c8: cf 93 push r28
1ca: cd b7 in r28, 0x3d ; 61
1cc: de b7 in r29, 0x3e ; 62
1ce: 63 97 sbiw r28, 0x13 ; 19
1d0: 0f b6 in r0, 0x3f ; 63
1d2: f8 94 cli
1d4: de bf out 0x3e, r29 ; 62
1d6: 0f be out 0x3f, r0 ; 63
1d8: cd bf out 0x3d, r28 ; 61
LCD_init(); //Inicializace LCD
1da: 69 df rcall .-302 ; 0xae <LCD_init>
 
 
 
 
sprintf(zasobnik,"LCD je OK");
1dc: 8e 01 movw r16, r28
1de: 0f 5f subi r16, 0xFF ; 255
1e0: 1f 4f sbci r17, 0xFF ; 255
1e2: c8 01 movw r24, r16
1e4: 60 e6 ldi r22, 0x60 ; 96
1e6: 70 e0 ldi r23, 0x00 ; 0
1e8: 1b d0 rcall .+54 ; 0x220 <strcpy>
LCD_gotoxy(0,0);
1ea: 80 e0 ldi r24, 0x00 ; 0
1ec: 60 e0 ldi r22, 0x00 ; 0
1ee: 9f df rcall .-194 ; 0x12e <LCD_gotoxy>
ProcesDispl(zasobnik);
1f0: c8 01 movw r24, r16
1f2: a4 df rcall .-184 ; 0x13c <ProcesDispl>
LCD_gotoxy(0,2);
1f4: 80 e0 ldi r24, 0x00 ; 0
1f6: 62 e0 ldi r22, 0x02 ; 2
1f8: 9a df rcall .-204 ; 0x12e <LCD_gotoxy>
ProcesDispl(zasobnik);
1fa: c8 01 movw r24, r16
1fc: 9f df rcall .-194 ; 0x13c <ProcesDispl>
1fe: 8a ef ldi r24, 0xFA ; 250
200: 90 e0 ldi r25, 0x00 ; 0
202: 01 97 sbiw r24, 0x01 ; 1
204: f1 f7 brne .-4 ; 0x202 <main+0x40>
 
return 0;
 
 
 
}
206: 80 e0 ldi r24, 0x00 ; 0
208: 90 e0 ldi r25, 0x00 ; 0
20a: 63 96 adiw r28, 0x13 ; 19
20c: 0f b6 in r0, 0x3f ; 63
20e: f8 94 cli
210: de bf out 0x3e, r29 ; 62
212: 0f be out 0x3f, r0 ; 63
214: cd bf out 0x3d, r28 ; 61
216: cf 91 pop r28
218: df 91 pop r29
21a: 1f 91 pop r17
21c: 0f 91 pop r16
21e: 08 95 ret
 
00000220 <strcpy>:
220: fb 01 movw r30, r22
222: dc 01 movw r26, r24
224: 01 90 ld r0, Z+
226: 0d 92 st X+, r0
228: 00 20 and r0, r0
22a: e1 f7 brne .-8 ; 0x224 <strcpy+0x4>
22c: 08 95 ret
 
0000022e <_exit>:
22e: f8 94 cli
 
00000230 <__stop_program>:
230: ff cf rjmp .-2 ; 0x230 <__stop_program>
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/LCD_zkouska.map
0,0 → 1,372
Archive member included because of file (symbol)
 
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o (exit)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
LCD_zkouska.o (__do_copy_data)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a(strcpy.o)
LCD_zkouska.o (strcpy)
 
Memory Configuration
 
Name Origin Length Attributes
text 0x00000000 0x00002000 xr
data 0x00800060 0x0000ffa0 rw !x
eeprom 0x00810000 0x00010000 rw !x
fuse 0x00820000 0x00000400 rw !x
lock 0x00830000 0x00000400 rw !x
signature 0x00840000 0x00000400 rw !x
*default* 0x00000000 0xffffffff
 
Linker script and memory map
 
LOAD c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
LOAD LCD_zkouska.o
LOAD c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a
LOAD c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a
LOAD c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a
 
.hash
*(.hash)
 
.dynsym
*(.dynsym)
 
.dynstr
*(.dynstr)
 
.gnu.version
*(.gnu.version)
 
.gnu.version_d
*(.gnu.version_d)
 
.gnu.version_r
*(.gnu.version_r)
 
.rel.init
*(.rel.init)
 
.rela.init
*(.rela.init)
 
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
 
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
 
.rel.fini
*(.rel.fini)
 
.rela.fini
*(.rela.fini)
 
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
 
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
 
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
 
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
 
.rel.ctors
*(.rel.ctors)
 
.rela.ctors
*(.rela.ctors)
 
.rel.dtors
*(.rel.dtors)
 
.rela.dtors
*(.rela.dtors)
 
.rel.got
*(.rel.got)
 
.rela.got
*(.rela.got)
 
.rel.bss
*(.rel.bss)
 
.rela.bss
*(.rela.bss)
 
.rel.plt
*(.rel.plt)
 
.rela.plt
*(.rela.plt)
 
.text 0x00000000 0x232
*(.vectors)
.vectors 0x00000000 0x26 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
0x00000000 __vectors
0x00000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
*(.progmem*)
.progmem.data 0x00000026 0x4 LCD_zkouska.o
0x00000026 LCD_INIT_STRING
0x0000002a . = ALIGN (0x2)
0x0000002a __trampolines_start = .
*(.trampolines)
.trampolines 0x0000002a 0x0 linker stubs
*(.trampolines*)
0x0000002a __trampolines_end = .
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000002a __ctors_start = .
*(.ctors)
0x0000002a __ctors_end = .
0x0000002a __dtors_start = .
*(.dtors)
0x0000002a __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000002a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
0x0000002a __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000002a 0xc c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000036 0x16 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
0x00000036 __do_copy_data
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000004c 0x4 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
*(.init9)
*(.text)
.text 0x00000050 0x2 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
0x00000050 __vector_1
0x00000050 __vector_12
0x00000050 __bad_interrupt
0x00000050 __vector_6
0x00000050 __vector_3
0x00000050 __vector_11
0x00000050 __vector_13
0x00000050 __vector_17
0x00000050 __vector_7
0x00000050 __vector_5
0x00000050 __vector_4
0x00000050 __vector_9
0x00000050 __vector_2
0x00000050 __vector_15
0x00000050 __vector_8
0x00000050 __vector_14
0x00000050 __vector_10
0x00000050 __vector_16
0x00000050 __vector_18
.text 0x00000052 0x1ce LCD_zkouska.o
0x00000120 LCD_clear
0x00000060 LCD_send_nibble
0x000000a6 LCD_send_command
0x000000ae LCD_init
0x00000084 LCD_send
0x00000052 LCD_init_IO_PIN
0x0000009c LCD_send_data
0x000001c2 main
0x000000a2 LCD_putc
0x0000012e LCD_gotoxy
0x0000013c ProcesDispl
.text 0x00000220 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
.text 0x00000220 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
.text 0x00000220 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a(strcpy.o)
0x00000220 . = ALIGN (0x2)
*(.text.*)
.text.libgcc 0x00000220 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
.text.libgcc 0x00000220 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
.text.avr-libc
0x00000220 0xe c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a(strcpy.o)
0x00000220 strcpy
0x0000022e . = ALIGN (0x2)
*(.fini9)
.fini9 0x0000022e 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
0x0000022e exit
0x0000022e _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x0000022e 0x4 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
*(.fini0)
0x00000232 _etext = .
 
.data 0x00800060 0xa load address 0x00000232
0x00800060 PROVIDE (__data_start, .)
*(.data)
.data 0x00800060 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
.data 0x00800060 0xa LCD_zkouska.o
.data 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
.data 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
.data 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a(strcpy.o)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x0080006a . = ALIGN (0x2)
0x0080006a _edata = .
0x0080006a PROVIDE (__data_end, .)
 
.bss 0x0080006a 0x0
0x0080006a PROVIDE (__bss_start, .)
*(.bss)
.bss 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crtm8.o
.bss 0x0080006a 0x0 LCD_zkouska.o
.bss 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_exit.o)
.bss 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr4\libgcc.a(_copy_data.o)
.bss 0x0080006a 0x0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4\libc.a(strcpy.o)
*(.bss*)
*(COMMON)
0x0080006a PROVIDE (__bss_end, .)
0x00000232 __data_load_start = LOADADDR (.data)
0x0000023c __data_load_end = (__data_load_start + SIZEOF (.data))
 
.noinit 0x0080006a 0x0
0x0080006a PROVIDE (__noinit_start, .)
*(.noinit*)
0x0080006a PROVIDE (__noinit_end, .)
0x0080006a _end = .
0x0080006a PROVIDE (__heap_start, .)
 
.eeprom 0x00810000 0x0
*(.eeprom*)
0x00810000 __eeprom_end = .
 
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
 
.lock
*(.lock*)
 
.signature
*(.signature*)
 
.stab
*(.stab)
 
.stabstr
*(.stabstr)
 
.stab.excl
*(.stab.excl)
 
.stab.exclstr
*(.stab.exclstr)
 
.stab.index
*(.stab.index)
 
.stab.indexstr
*(.stab.indexstr)
 
.comment
*(.comment)
 
.debug
*(.debug)
 
.line
*(.line)
 
.debug_srcinfo
*(.debug_srcinfo)
 
.debug_sfnames
*(.debug_sfnames)
 
.debug_aranges 0x00000000 0x20
*(.debug_aranges)
.debug_aranges
0x00000000 0x20 LCD_zkouska.o
 
.debug_pubnames
0x00000000 0xd2
*(.debug_pubnames)
.debug_pubnames
0x00000000 0xd2 LCD_zkouska.o
 
.debug_info 0x00000000 0x577
*(.debug_info)
.debug_info 0x00000000 0x577 LCD_zkouska.o
*(.gnu.linkonce.wi.*)
 
.debug_abbrev 0x00000000 0x1da
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x1da LCD_zkouska.o
 
.debug_line 0x00000000 0x413
*(.debug_line)
.debug_line 0x00000000 0x413 LCD_zkouska.o
 
.debug_frame 0x00000000 0xc0
*(.debug_frame)
.debug_frame 0x00000000 0xc0 LCD_zkouska.o
 
.debug_str 0x00000000 0x192
*(.debug_str)
.debug_str 0x00000000 0x192 LCD_zkouska.o
0x1d0 (size before relaxing)
 
.debug_loc 0x00000000 0x17f
*(.debug_loc)
.debug_loc 0x00000000 0x17f LCD_zkouska.o
 
.debug_macinfo
*(.debug_macinfo)
OUTPUT(LCD_zkouska.elf elf32-avr)
LOAD linker stubs
 
.debug_ranges 0x00000000 0xa8
.debug_ranges 0x00000000 0xa8 LCD_zkouska.o
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/default/dep/LCD_zkouska.o.d
0,0 → 1,53
LCD_zkouska.o: ../LCD_zkouska.c \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/io.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/sfr_defs.h \
c:/winavr-20100110/lib/gcc/../../avr/include/inttypes.h \
c:/winavr-20100110/lib/gcc/../../avr/include/stdint.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/iom8.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/portpins.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/common.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/version.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/fuse.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/lock.h \
c:/winavr-20100110/lib/gcc/../../avr/include/stdio.h \
c:\winavr-20100110\bin\../lib/gcc/avr/4.3.3/include/stdarg.h \
c:\winavr-20100110\bin\../lib/gcc/avr/4.3.3/include/stddef.h ../lcd.h \
../lcd.c c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h \
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay_basic.h \
c:/winavr-20100110/lib/gcc/../../avr/include/avr/pgmspace.h
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/io.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/sfr_defs.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/inttypes.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/stdint.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/iom8.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/portpins.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/common.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/version.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/fuse.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/lock.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/stdio.h:
 
c:\winavr-20100110\bin\../lib/gcc/avr/4.3.3/include/stdarg.h:
 
c:\winavr-20100110\bin\../lib/gcc/avr/4.3.3/include/stddef.h:
 
../lcd.h:
 
../lcd.c:
 
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/util/delay_basic.h:
 
c:/winavr-20100110/lib/gcc/../../avr/include/avr/pgmspace.h:
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/lcd.c
0,0 → 1,147
/* mija 2008
 
source file for lcd HITACHI 16x2,8x2,...
 
!!! must be set PINs,PORTs,DDR in lcd.h
ver.: 0.0 TESTED
*/
 
 
#include <avr/io.h>
#include <util/delay.h>
#include <avr/pgmspace.h>
#include "lcd.h"
 
//#include <stdio.h>
 
//*************************************************************
 
#define H_D0 PORT_D0 |=_BV(PIN_D0)
#define L_D0 PORT_D0 &= ~(_BV(PIN_D0))
 
#define H_D1 PORT_D1 |=_BV(PIN_D1)
#define L_D1 PORT_D1 &= ~(_BV(PIN_D1))
 
#define H_D2 PORT_D2 |=_BV(PIN_D2)
#define L_D2 PORT_D2 &= ~(_BV(PIN_D2))
 
#define H_D3 PORT_D3 |=_BV(PIN_D3)
#define L_D3 PORT_D3 &= ~(_BV(PIN_D3))
 
#define H_E PORT_E |=_BV(PIN_E)
#define L_E PORT_E &= ~(_BV(PIN_E))
 
#define H_RS PORT_RS |=_BV(PIN_RS)
#define L_RS PORT_RS &= ~(_BV(PIN_RS))
 
//*************************************************************
 
// Definice konstant pro LCD display
//
#define LCD_CURSOR_ON_ 0x0E // kurzor jako blikajici radka pod znakem
#define LCD_CURSOR_OFF_ 0x0C // zadny kurzor
#define LCD_LINE_2 0x40 // adresa 1. znaku 2. radky
 
 
// Definice rezimu LCD displeje
//
 
uint8_t PROGMEM LCD_INIT_STRING[4] =
{
0x28, // intrfejs 4 bity, 2 radky, font 5x7
LCD_CURSOR_OFF_, // display on, kurzor off,
0x01, // clear displeje
0x06 // inkrement pozice kurzoru (posun kurzoru doprava)
};
 
void LCD_init_IO_PIN(void)
{
DDR_D0 |= _BV(PIN_D0);
DDR_D1 |= _BV(PIN_D1);
DDR_D2 |= _BV(PIN_D2);
DDR_D3 |= _BV(PIN_D3);
DDR_E |= _BV(PIN_E);
DDR_RS |= _BV(PIN_RS);
}
 
void LCD_init(void)
{
uint8_t a;
 
LCD_init_IO_PIN();
_delay_ms(20);
L_E;
L_RS;
for (a=0;a<3;a++)
{
_delay_ms(2);
LCD_send_nibble(0x3);
}
_delay_us(40);
LCD_send_nibble(0x2);
_delay_us(40);
for (a=0;a<3;a++)
{
LCD_send_command(pgm_read_byte(&(LCD_INIT_STRING[a])));
_delay_ms(2);
}
}
 
void LCD_putc(uint8_t data)
{
LCD_send_data(data);
}
 
void LCD_send_command(uint8_t data)
{
L_RS;
LCD_send(data);
H_RS;
}
 
void LCD_send_data(uint8_t data)
{
H_RS;
LCD_send(data);
}
 
void LCD_send(uint8_t data)
{
LCD_send_nibble(data >> 4);
LCD_send_nibble(data);
_delay_us(40);
}
 
void LCD_send_nibble(uint8_t data)
{
L_D0;L_D1;L_D2;L_D3;
if (data & 0x1) H_D0;
if (data & 0x2) H_D1;
if (data & 0x4) H_D2;
if (data & 0x8) H_D3;
H_E;
_delay_us(1);
L_E;
}
 
 
void LCD_clear(void)
{
LCD_send_command(1);
_delay_ms(2);
}
 
void LCD_gotoxy( uint8_t x, uint8_t y)
{
uint8_t Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
LCD_send_command(0x80|Adr);
}
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/lcd.h
0,0 → 1,75
/* mija 2008
 
*.h file for defines lcd.c
 
data PIN_D0
PIN_D1
PIN_D2
PIN_D3
write PIN_E
commamnd/data PIN_RS
 
!!!!NOTE must be set PIN with PORT and DDR
*/
 
//*************************************************************
 
#define PIN_D0 PC3
#define PORT_D0 PORTC
#define DDR_D0 DDRC
 
#define PIN_D1 PB4
#define PORT_D1 PORTB
#define DDR_D1 DDRB
 
#define PIN_D2 PB5
#define PORT_D2 PORTB
#define DDR_D2 DDRB
 
#define PIN_D3 PB3
#define PORT_D3 PORTB
#define DDR_D3 DDRB
 
#define PIN_E PB1
#define PORT_E PORTB
#define DDR_E DDRB
 
#define PIN_RS PB2
#define PORT_RS PORTB
#define DDR_RS DDRB
 
//*************************************************************
 
void LCD_init(void);
void LCD_putc(uint8_t data);
void LCD_gotoxy( uint8_t x, uint8_t y);
void LCD_clear(void);
 
void LCD_send_data(uint8_t data);
void LCD_send_command(uint8_t data);
void LCD_send(uint8_t data);
void LCD_send_nibble(uint8_t data);
void LCD_init_IO_PIN(void);
 
//*************************************************************
 
 
//********************** example printf ***********************
/*
#inlcude <stdio.h>
 
static int put_lcd(char c, FILE *stream);
static FILE mystdout = FDEV_SETUP_STREAM(put_lcd, NULL,_FDEV_SETUP_WRITE);
 
static int put_lcd(char c, FILE *stream)
{
switch (c)
{
case '\n': LCD_gotoxy(1,2);break;
case '\r': LCD_gotoxy(1,1);break;
default : LCD_putc(c);
}
return 0;
}*/
//*************************************************************
 
/Modules/HumanInterfaces/LCD2L4P02A/SW/AVR/lcd_zkouska.aws
0,0 → 1,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA8"/><Files><File00000 Name="C:\Users\Honza\Documents\c\LCD_zkouska\LCD_zkouska.c" Position="268 99 989 381" LineCol="3 35"/></Files></AVRWorkspace>