Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
content
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Gerner
content
Commits
18161602
Commit
18161602
authored
13 years ago
by
Michal Rybka
Browse files
Options
Downloads
Patches
Plain Diff
Přidán článek AVR - LCD panel - wait.c
(Autoexportován z Joomly)
parent
f387678f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
articles/2012/avr-lcd-panel-waitc.md
+95
-0
95 additions, 0 deletions
articles/2012/avr-lcd-panel-waitc.md
with
95 additions
and
0 deletions
articles/2012/avr-lcd-panel-waitc.md
0 → 100644
+
95
−
0
View file @
18161602
+++
title = "AVR - LCD panel - wait.c"
perex_e = "
Kompatibilní zapojení: LCD panel s ATmega8
Ke stažení: wait.c == wait.pdf == wait.htm
.
.
"
tags = ["Článek"]
+++
Kompatibilní zapojení: LCD panel s ATmega8
Ke stažení: wait.c == wait.pdf == wait.htm
.
.
* * *
<title>
Untitled
</title>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<meta
name=
"generator"
content=
"SynEdit HTML exporter"
>
<style
type=
"text/css"
>
&
amp
;
lt
;
!-- body { color: #000000; background-color: #FFFFFF; } .cpp1-assembler { } .cpp1-brackets { } .cpp1-comment { color: #008000; font-style: italic; } .cpp1-float { color: #000080; } .cpp1-hexadecimal { color: #000080; } .cpp1-character { } .cpp1-identifier { } .cpp1-illegalchar { } .cpp1-number { color: #000080; } .cpp1-octal { color: #0000FF; } .cpp1-preprocessor { } .cpp1-reservedword { font-weight: bold; } .cpp1-space { color: #008080; } .cpp1-string { color: #800000; } .cpp1-symbol { } --
&
amp
;
gt
;
</style>
```
/*---------------------------------------------------------------------------
soubor: wait.c
verze: 1.0
datum: 9.1.2012
popis:
Cekaci rutiny a makra pro bitove operace
Cekaci rutiny jsou mnohem uspornejsi nez bezne "delay.h"
Tento soubor vynikl ze souboru "mojelib.h" jehoz autora bohuzel neznam.
---------------------------------------------------------------------------*/
// Zmena bitu portu, IO registru nebo promenne:
#define setb(bajt,bit) bajt |= 1<<(bit) //nastav bit
#define clrb(bajt,bit) bajt &= ~(1<<(bit)) //nuluj bit
#define negb(bajt,bit) bajt ^= 1<<(bit) //neguj bit
// Casove smycky:
void wait_ms (unsigned int c); // cekej milisekund(max65553):
void wait_us (unsigned int c); // cekej mikrosekund(max65553):
//cekej milisekund:
unsigned char reg21 = F_CPU / 60000; // F_CPU = frekv. oscilatoru [Hz],
// (vnitrni konstanta prekladace)
void wait_ms (unsigned int c)
{
asm("push r20");
asm("push r21");
asm("_Wms0:");
asm("ldi r20,0x14");
asm("_Wms1:");
asm("lds r21,reg21");
asm("_Wms2:");
asm("dec r21");
asm("brne _Wms2");
asm("dec r20");
asm("brne _Wms1");
asm("dec r24");
asm("brne _Wms0");
asm("dec r25");
asm("brpl _Wms0");
asm("pop r21");
asm("pop r20");
}
//cekej mikrosekund:
unsigned char reg20 = F_CPU / 6000000 + 1;
void wait_us(unsigned int c)
{
asm("push r20");
asm("_wus0:");
asm("lds r20,reg20"); // 1-6MHz: r20=1 6-12MHz: r20=2
asm("_wus1:");
asm("dec r20");
asm("brne _wus1");
asm("dec r24");
asm("brne _wus0");
asm("dec r25");
asm("brpl _wus0");
asm("pop r20");
}
//eof
//(c) OK1ZKV 2012
```
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment