Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Ignore whitespace Rev 410 → Rev 659

/programy/C/PIC/mereni/otmer/16F873/LCD.C
0,0 → 1,311
// LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
// (c)miho 2002,2005
//
// Historie:
//
// 0.00 Uvodni verze se snadnou definici portu LCD displeje
// 0.01 Oprava portu (zapomenute stare identifikatory)
// 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
// 0.03 Doplnena procedura lcd_clr pro smazani displeje
//
//
// Funkce:
//
// lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
//
// lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
// \f = \x0C - nova stranka - smazani displeje
// \n = \x0A - odradkovani (prechod na druhou radku)
// \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
// \r = \x0D - goto home to position 1,1
// \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
// \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
// Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
//
// lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
// nekontroluje parametry
//
// lcd_cursor_on zapne kurzor
// lcd_cursor_off vypne kurzor
//
// lcd_clr smaze displej
//
// lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
// retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
// Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
// Na konci se provede lcd_gotoxy(1,1).
// Na konci teto knihovny je priklad pouziti definovanych znaku
//
//
// Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
//
//
// Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
//
// #define LCD_RS PIN_B2 // rizeni registru LCD displeje
// #define LCD_E PIN_B1 // enable LCD displeje
// #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
// #define LCD_D1 PIN_C3 // D1
// #define LCD_D2 PIN_C4 // D2
// #define LCD_D3 PIN_C5 // D3
 
 
 
 
// Privatni sekce, cist jen v pripade, ze neco nefunguje
 
 
 
 
#ifdef LCD_DATA_LSB
// Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
// bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
// v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
//
#define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
#define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
#define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
#define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
//
#if LCD_SHIFT>4 // kontrola mezi
#error LCD data port LSB bit not in range 0..4
#endif
#endif
 
 
// 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
//
BYTE const 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)
};
 
 
// Odesle nibble do displeje (posle data a klikne signalem e)
//
void lcd_send_nibble( BYTE n )
{
#ifdef LCD_DATA_LSB
// data jsou za sebou na 4 bitech jednoho portu
*LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
#else
// data jsou na libovolnych 4 bitech libovolnych portu
output_bit(LCD_D0,bit_test(n,0));
output_bit(LCD_D1,bit_test(n,1));
output_bit(LCD_D2,bit_test(n,2));
output_bit(LCD_D3,bit_test(n,3));
#endif
output_bit(LCD_E,1); // vzestupna hrana
delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
}
 
 
// Odesle bajt do registru LCD
//
// Pokud je Adr=0 .. instrukcni registr
// Pokud je Adr=1 .. datovy registr
//
void lcd_send_byte( BOOLEAN Adr, BYTE n )
{
output_bit(LCD_RS,Adr); // vyber registr
swap(n);
lcd_send_nibble(n); // posli horni pulku bajtu
swap(n);
lcd_send_nibble(n); // posli spodni pulku bajtu
delay_us(40); // minimalni doba na provedeni prikazu
}
 
 
// Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
//
// Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
//
void lcd_init()
{
 
int i; // pocitadlo cyklu
 
delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
 
#ifdef LCD_DATA_LSB
// data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
*LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
#endif
 
output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
 
for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
{
delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
lcd_send_nibble(3); // rezim 8 bitu
}
 
delay_us(40); // cas na zpracovani
lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
delay_us(40); // cas na zpracovani
 
for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
delay_ms(2);
}
}
 
 
// Proved presun kurzoru
//
// Pozice 1.1 je domu
//
void lcd_gotoxy( BYTE x, BYTE y)
{
 
BYTE Adr;
 
Adr=x-1;
if(y==2)
Adr+=LCD_LINE_2;
 
lcd_send_byte(0,0x80|Adr);
}
 
 
// Zapis znaku na displej, zpracovani ridicich znaku
//
void lcd_putc( char c)
{
 
switch (c)
{
case '\f' : lcd_send_byte(0,1); // smaz displej
delay_ms(2);
break;
case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
case '\r' : lcd_gotoxy(1,1); break; // presun home
case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
lcd_send_byte(1,c); break; // zapis znak
}
}
 
 
// Zapni kurzor
//
void lcd_cursor_on()
{
lcd_send_byte(0,LCD_CURSOR_ON_);
}
 
 
// Vypni kurzor
//
void lcd_cursor_off()
{
lcd_send_byte(0,LCD_CURSOR_OFF_);
}
 
 
// Smaz displej
//
void lcd_clr()
{
lcd_putc('\f');
}
 
 
// Definice vlastnich fontu
//
// Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
// Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
// priklad pouziti definovanych znaku.
 
 
// Pomocna procedura pro posilani ridicich dat do radice displeje
//
void lcd_putc2(int Data)
{
lcd_send_byte(1,Data);
}
 
 
// Pomocne definice pro programovani obsahu CGRAM
//
#define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
#define lcd_define_def(String) printf(lcd_putc2,String);
#define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
 
 
// Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
//
#define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
 
 
// Pripravene definice fontu vybranych znaku
// V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
//
#define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
#define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
#define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
#define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
#define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
#define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
#define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
#define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
#define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
#define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
#define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
#define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
#define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
#define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
#define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
#define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
#define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
#define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
#define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
#define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
#define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
#define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
#define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
#define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
#define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
#define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
#define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
#define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
#define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
#define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
#define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
#define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
#define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
#define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
#define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
 
 
// Priklad pouziti definovanych znaku
//
//
//void lcd_sample()
//{
// lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
// lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
// // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
// // jediny definicni retezec)
// printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
// delay_ms(1000);
// lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
// delay_ms(1000);
//}
/programy/C/PIC/mereni/otmer/16F873/otmer.BAK
0,0 → 1,44
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
 
//Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "LCD.C"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "C:\library\kaklik\ccs\shift_reg.c"
 
void main()
{
unsigned int16 otacky;
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_OFF);
 
lcd_init();
 
while (true)
{
set_timer1(0);
 
Delay_ms(500);
otacky=get_timer1();
otacky=otacky*40;
 
LCD_gotoxy(2,2);
printf(lcd_putc,"otacky:%lu ot/min ",otacky);
}
 
}
/programy/C/PIC/mereni/otmer/16F873/otmer.HEX
0,0 → 1,64
:1000000000308A00582900000A108A100A1182075D
:1000100028340C34013406340A108A100A1182077D
:100020006F347434613463346B3479343A34253446
:100030006C34753420346F3474342F346D34693437
:100040006E34203420340034323084000008031928
:1000500038280130A100A001A00B2C28A10B2B28CF
:100060004A30A000A00B322800000000800B292895
:10007000003407080F39B900380EA000F030A00591
:100080002008F03939048700061483160610000092
:10009000831206108316061083120034B608031D5F
:1000A0005328861054288614831686108312B70EA0
:1000B0003708B8003920B70E3708B80039200D309E
:1000C000A000A00B612800341430B20024200F30AF
:1000D00083168705831286108316861083120610F6
:1000E000831606108312A8012808023C031C8028EE
:1000F0000230B20024200330B8003920A80A742846
:100100000D30A000A00B82280230B80039200D303D
:10011000A000A00B8928A8012808023C031C9C28E9
:1001200028080420A900B6012908B7004E20023093
:10013000B2002420A80A8C288A119C291030A00023
:10014000A301AC01A90CA80C031CAC282A08A30726
:100150000318AC0A2B08AC07AC0CA30CA20CA10C26
:10016000A00BA2288A11B92901303202B400330849
:10017000023C031DBD284030B40734088038B50068
:10018000B6013508B7004E20003431080C3A031987
:10019000D328063A0319DB28073A0319E128053A60
:1001A0000319E628EB28B6010130B7004E200230D3
:1001B000B2002420F7280130B2000230B300B4208E
:1001C000F7280130B200B300B420F728B601103090
:1001D000B7004E20F72831081F3C031CF1280730D8
:1001E000B1050130B6003108B7004E20F7280034C1
:1001F0000408B0002A0EF038AC00AC07E23EAD00B7
:10020000323EAF002A080F39AD07AD07AF07E93E10
:10021000AE00AE07AE07290E0F39AE07AF07AE0D21
:10022000AF0DAF09AF0D29080F39AF07AC0D07307F
:10023000AB000A30AF07AE03031C1A29AE07AD03AB
:10024000031C1E29AD07AC03031C2229AC07AB031A
:10025000031C26292B3084000730300584072F30FB
:10026000040203194F290008A000031D3D29301A7C
:100270004D29B0193F29203040290830B0003030D6
:10028000A007AA010408A9002008AB002008B100BB
:10029000C520290884002B08A000840A2F29000803
:1002A000A0003030A0072008B100C5208A11D8294D
:1002B00084011F30830583161F149F141F159F117F
:1002C000FF308312A50083161F149F141F159F1162
:1002D00083121F109412A51225088316870083121B
:1002E00025162508831687008312A5112508831675
:1002F0008700003083129400831694000108C739E8
:10030000383881009730831290000030A1009200AD
:10031000003083169200831225112508831687006A
:10032000831207110C309700A51425088316870047
:1003300083129D019D0164288F018E010230A80067
:10034000FA30B2002420A80BA0290F08A3000E0841
:10035000A0000F082302031DA5292008A6002308DA
:10036000A7002708A9002608A800AB012830AA008A
:100370009E282208A7002108A6002608A00027081A
:10038000A300C2290230B200B300B420A80128089B
:100390000C20A80AA000B100C52007302802031DC8
:1003A000C729103084002708AA002608A900F828C9
:1003B0000A30A90029080C20A90AA000B100C52014
:0C03C00013302902031DDA299C29630078
:02400E00793FF8
:00000001FF
;PIC16F873
/programy/C/PIC/mereni/otmer/16F873/otmer.LST
0,0 → 1,762
CCS PCM C Compiler, Version 3.221, 27853 19-VIII-05 18:09
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.LST
 
ROM used: 486 words (12%)
Largest free fragment is 2048
RAM used: 10 (5%) at main() level
27 (14%) worst case
Stack: 5 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 158
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
.................... #include <16F873.h>
.................... //////// Standard Header file for the PIC16F873 device ////////////////
.................... #device PIC16F873
.................... #list
....................
.................... #device adc=8
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
.................... #use delay(clock=4000000)
*
0024: MOVLW 32
0025: MOVWF 04
0026: MOVF 00,W
0027: BTFSC 03.2
0028: GOTO 038
0029: MOVLW 01
002A: MOVWF 21
002B: CLRF 20
002C: DECFSZ 20,F
002D: GOTO 02C
002E: DECFSZ 21,F
002F: GOTO 02B
0030: MOVLW 4A
0031: MOVWF 20
0032: DECFSZ 20,F
0033: GOTO 032
0034: NOP
0035: NOP
0036: DECFSZ 00,F
0037: GOTO 029
0038: RETLW 00
....................
....................
....................
.................... //Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
....................
.................... #define LCD_RS PIN_B1 // rizeni registru LCD displeje
.................... #define LCD_E PIN_B0 // enable LCD displeje
.................... #define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
....................
.................... #include "LCD.C"
.................... // LCD modul pro ovladani dvouradkoveho LCD modulu se standardnim Hitachi radicem
.................... // (c)miho 2002,2005
.................... //
.................... // Historie:
.................... //
.................... // 0.00 Uvodni verze se snadnou definici portu LCD displeje
.................... // 0.01 Oprava portu (zapomenute stare identifikatory)
.................... // 0.02 Doplnena moznost pripojeni datoveho portu LCD na libovolne porty
.................... // 0.03 Doplnena procedura lcd_clr pro smazani displeje
.................... //
.................... //
.................... // Funkce:
.................... //
.................... // lcd_init() inicializuje LCD displej a porty, nutno volat jako prvni
.................... //
.................... // lcd_putc(c) zapis snaku do lcd displeje, zpracovava nasledujici ridici znaky
.................... // \f = \x0C - nova stranka - smazani displeje
.................... // \n = \x0A - odradkovani (prechod na druhou radku)
.................... // \b = \x08 - backspace - posunuti kurzoru o 1 pozici zpet
.................... // \r = \x0D - goto home to position 1,1
.................... // \0 .. \7 - definovatelne znaky v pozicich 0 az 7 v CGRAM
.................... // \20 .. \27 - alternativne zapsane znaky (oktalove) v pozicich 0 az 7 CGRAM
.................... // Pozor na to, ze funkce printf konci tisk pokud narazi na \0 (konec retezce)
.................... //
.................... // lcd_gotoxy(x,y) presune kurzor na uvedenou adresu
.................... // nekontroluje parametry
.................... //
.................... // lcd_cursor_on zapne kurzor
.................... // lcd_cursor_off vypne kurzor
.................... //
.................... // lcd_clr smaze displej
.................... //
.................... // lcd_define_char(Index, Def) Makro, ktere definuje znaky od pozice Index obsahem definicniho
.................... // retezce Def. Kazdych 8 znaku retezce Def definuje dalsi znak v CGRAM.
.................... // Kapacita CGRAM je celkem 8 znaku s indexem 0 az 7.
.................... // Na konci se provede lcd_gotoxy(1,1).
.................... // Na konci teto knihovny je priklad pouziti definovanych znaku
.................... //
.................... //
.................... // Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_DATA_LSB PIN_C2 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
.................... //
.................... //
.................... // Alternativni definice: // Datovy port displeje pripojeny na libovolne 4 bitove porty (vede na kod delsi asi o 25 slov)
.................... //
.................... // #define LCD_RS PIN_B2 // rizeni registru LCD displeje
.................... // #define LCD_E PIN_B1 // enable LCD displeje
.................... // #define LCD_D0 PIN_C2 // D0 - datove bity pripojene na libovolne porty
.................... // #define LCD_D1 PIN_C3 // D1
.................... // #define LCD_D2 PIN_C4 // D2
.................... // #define LCD_D3 PIN_C5 // D3
....................
....................
....................
....................
.................... // Privatni sekce, cist jen v pripade, ze neco nefunguje
....................
....................
....................
....................
.................... #ifdef LCD_DATA_LSB
.................... // Generovane defince portu pro ucely teto knihovny aby kod generoval spravne IO operace a soucasne
.................... // bylo mozne jednoduse deklarovat pripojene piny LCD displeje pri pouziti teto knihovny. Problem spociva
.................... // v tom, ze se musi spravne ridit smery portu a soucasne datovy port zabira jen 4 bity ze zadaneho portu
.................... //
.................... #define LCD_SHIFT (LCD_DATA_LSB&7) // pocet bitu posuvu datoveho kanalu v datovem portu
.................... #define LCD_PORT (LCD_DATA_LSB>>3) // adresa LCD datoveho portu
.................... #define LCD_TRIS (LCD_PORT+0x80) // adresa prislusneho TRIS registru
.................... #define LCD_MASK (0xF<<LCD_SHIFT) // maska platnych bitu
.................... //
.................... #if LCD_SHIFT>4 // kontrola mezi
.................... #error LCD data port LSB bit not in range 0..4
.................... #endif
.................... #endif
....................
....................
.................... // 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
.................... //
.................... BYTE const 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)
.................... };
....................
....................
.................... // Odesle nibble do displeje (posle data a klikne signalem e)
.................... //
.................... void lcd_send_nibble( BYTE n )
.................... {
.................... #ifdef LCD_DATA_LSB
.................... // data jsou za sebou na 4 bitech jednoho portu
.................... *LCD_PORT = (*LCD_PORT & ~LCD_MASK) | ((n << LCD_SHIFT) & LCD_MASK); // nastav datove bity portu a ostatni zachovej
0039: MOVF 07,W
003A: ANDLW 0F
003B: MOVWF 39
003C: SWAPF 38,W
003D: MOVWF 20
003E: MOVLW F0
003F: ANDWF 20,F
0040: MOVF 20,W
0041: ANDLW F0
0042: IORWF 39,W
0043: MOVWF 07
.................... #else
.................... // data jsou na libovolnych 4 bitech libovolnych portu
.................... output_bit(LCD_D0,bit_test(n,0));
.................... output_bit(LCD_D1,bit_test(n,1));
.................... output_bit(LCD_D2,bit_test(n,2));
.................... output_bit(LCD_D3,bit_test(n,3));
.................... #endif
.................... output_bit(LCD_E,1); // vzestupna hrana
0044: BSF 06.0
0045: BSF 03.5
0046: BCF 06.0
.................... delay_us(1); // pockej alespon 450ns od e nebo alespon 195ns od dat
0047: NOP
.................... output_bit(LCD_E,0); // sestupna hrana (minimalni perioda e je 1us)
0048: BCF 03.5
0049: BCF 06.0
004A: BSF 03.5
004B: BCF 06.0
.................... }
004C: BCF 03.5
004D: RETLW 00
....................
....................
.................... // Odesle bajt do registru LCD
.................... //
.................... // Pokud je Adr=0 .. instrukcni registr
.................... // Pokud je Adr=1 .. datovy registr
.................... //
.................... void lcd_send_byte( BOOLEAN Adr, BYTE n )
.................... {
.................... output_bit(LCD_RS,Adr); // vyber registr
004E: MOVF 36,F
004F: BTFSS 03.2
0050: GOTO 053
0051: BCF 06.1
0052: GOTO 054
0053: BSF 06.1
0054: BSF 03.5
0055: BCF 06.1
.................... swap(n);
0056: BCF 03.5
0057: SWAPF 37,F
.................... lcd_send_nibble(n); // posli horni pulku bajtu
0058: MOVF 37,W
0059: MOVWF 38
005A: CALL 039
.................... swap(n);
005B: SWAPF 37,F
.................... lcd_send_nibble(n); // posli spodni pulku bajtu
005C: MOVF 37,W
005D: MOVWF 38
005E: CALL 039
.................... delay_us(40); // minimalni doba na provedeni prikazu
005F: MOVLW 0D
0060: MOVWF 20
0061: DECFSZ 20,F
0062: GOTO 061
.................... }
0063: RETLW 00
....................
....................
.................... // Provede inicializaci LCD displeje, smaze obsah a nastavi mod displeje
.................... //
.................... // Tato procedura se musi volat pred pouzitim ostatnich lcd_ procedur
.................... //
.................... void lcd_init()
.................... {
....................
.................... int i; // pocitadlo cyklu
....................
.................... delay_ms(20); // spozdeni pro provedeni startu displeje po zapnuti napajeni
0064: MOVLW 14
0065: MOVWF 32
0066: CALL 024
....................
.................... #ifdef LCD_DATA_LSB
.................... // data jsou na 4 bitech za sebou, nastav smer pro vsechny dalsi prenosy
.................... *LCD_TRIS = *LCD_TRIS & ~LCD_MASK; // nuluj odpovidajici bity tris registru datoveho portu LCD
0067: MOVLW 0F
0068: BSF 03.5
0069: ANDWF 07,F
.................... #endif
....................
.................... output_bit(LCD_RS,0); // nastav jako vystup a nastav klidovy stav
006A: BCF 03.5
006B: BCF 06.1
006C: BSF 03.5
006D: BCF 06.1
.................... output_bit(LCD_E, 0); // nastav jako vystup a nastav klidovy stav
006E: BCF 03.5
006F: BCF 06.0
0070: BSF 03.5
0071: BCF 06.0
....................
.................... for (i=0; i<3; i++) // nastav lcd do rezimu 8 bitu sbernice
0072: BCF 03.5
0073: CLRF 28
0074: MOVF 28,W
0075: SUBLW 02
0076: BTFSS 03.0
0077: GOTO 080
.................... {
.................... delay_ms(2); // muze byt rozdelany prenos dat (2x 4 bity) nebo pomaly povel
0078: MOVLW 02
0079: MOVWF 32
007A: CALL 024
.................... lcd_send_nibble(3); // rezim 8 bitu
007B: MOVLW 03
007C: MOVWF 38
007D: CALL 039
.................... }
007E: INCF 28,F
007F: GOTO 074
....................
.................... delay_us(40); // cas na zpracovani
0080: MOVLW 0D
0081: MOVWF 20
0082: DECFSZ 20,F
0083: GOTO 082
.................... lcd_send_nibble(2); // nastav rezim 4 bitu (plati od nasledujiciho prenosu)
0084: MOVLW 02
0085: MOVWF 38
0086: CALL 039
.................... delay_us(40); // cas na zpracovani
0087: MOVLW 0D
0088: MOVWF 20
0089: DECFSZ 20,F
008A: GOTO 089
....................
.................... for (i=0;i<3;i++) // proved inicializaci (nastaveni modu, smazani apod)
008B: CLRF 28
008C: MOVF 28,W
008D: SUBLW 02
008E: BTFSS 03.0
008F: GOTO 09C
.................... {
.................... lcd_send_byte(0,LCD_INIT_STRING[i]);
0090: MOVF 28,W
0091: CALL 004
0092: MOVWF 29
0093: CLRF 36
0094: MOVF 29,W
0095: MOVWF 37
0096: CALL 04E
.................... delay_ms(2);
0097: MOVLW 02
0098: MOVWF 32
0099: CALL 024
.................... }
009A: INCF 28,F
009B: GOTO 08C
.................... }
009C: BCF 0A.3
009D: GOTO 19C (RETURN)
....................
....................
.................... // Proved presun kurzoru
.................... //
.................... // Pozice 1.1 je domu
.................... //
.................... void lcd_gotoxy( BYTE x, BYTE y)
.................... {
....................
.................... BYTE Adr;
....................
.................... Adr=x-1;
*
00B4: MOVLW 01
00B5: SUBWF 32,W
00B6: MOVWF 34
.................... if(y==2)
00B7: MOVF 33,W
00B8: SUBLW 02
00B9: BTFSS 03.2
00BA: GOTO 0BD
.................... Adr+=LCD_LINE_2;
00BB: MOVLW 40
00BC: ADDWF 34,F
....................
.................... lcd_send_byte(0,0x80|Adr);
00BD: MOVF 34,W
00BE: IORLW 80
00BF: MOVWF 35
00C0: CLRF 36
00C1: MOVF 35,W
00C2: MOVWF 37
00C3: CALL 04E
.................... }
00C4: RETLW 00
....................
....................
.................... // Zapis znaku na displej, zpracovani ridicich znaku
.................... //
.................... void lcd_putc( char c)
.................... {
....................
.................... switch (c)
.................... {
00C5: MOVF 31,W
00C6: XORLW 0C
00C7: BTFSC 03.2
00C8: GOTO 0D3
00C9: XORLW 06
00CA: BTFSC 03.2
00CB: GOTO 0DB
00CC: XORLW 07
00CD: BTFSC 03.2
00CE: GOTO 0E1
00CF: XORLW 05
00D0: BTFSC 03.2
00D1: GOTO 0E6
00D2: GOTO 0EB
.................... case '\f' : lcd_send_byte(0,1); // smaz displej
00D3: CLRF 36
00D4: MOVLW 01
00D5: MOVWF 37
00D6: CALL 04E
.................... delay_ms(2);
00D7: MOVLW 02
00D8: MOVWF 32
00D9: CALL 024
.................... break;
00DA: GOTO 0F7
.................... case '\n' : lcd_gotoxy(1,2); break; // presun se na 1. znak 2. radky
00DB: MOVLW 01
00DC: MOVWF 32
00DD: MOVLW 02
00DE: MOVWF 33
00DF: CALL 0B4
00E0: GOTO 0F7
.................... case '\r' : lcd_gotoxy(1,1); break; // presun home
00E1: MOVLW 01
00E2: MOVWF 32
00E3: MOVWF 33
00E4: CALL 0B4
00E5: GOTO 0F7
.................... case '\b' : lcd_send_byte(0,0x10); break; // posun kurzor o 1 zpet
00E6: CLRF 36
00E7: MOVLW 10
00E8: MOVWF 37
00E9: CALL 04E
00EA: GOTO 0F7
.................... default : if (c<0x20) c&=0x7; // preklopeni definovatelnych znaku na rozsah 0 az 0x1F
00EB: MOVF 31,W
00EC: SUBLW 1F
00ED: BTFSS 03.0
00EE: GOTO 0F1
00EF: MOVLW 07
00F0: ANDWF 31,F
.................... lcd_send_byte(1,c); break; // zapis znak
00F1: MOVLW 01
00F2: MOVWF 36
00F3: MOVF 31,W
00F4: MOVWF 37
00F5: CALL 04E
00F6: GOTO 0F7
.................... }
.................... }
00F7: RETLW 00
....................
....................
.................... // Zapni kurzor
.................... //
.................... void lcd_cursor_on()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_ON_);
.................... }
....................
....................
.................... // Vypni kurzor
.................... //
.................... void lcd_cursor_off()
.................... {
.................... lcd_send_byte(0,LCD_CURSOR_OFF_);
.................... }
....................
....................
.................... // Smaz displej
.................... //
.................... void lcd_clr()
.................... {
.................... lcd_putc('\f');
.................... }
....................
....................
.................... // Definice vlastnich fontu
.................... //
.................... // Vlastnich definic muze byt jen 8 do pozic 0 az 7 pameti CGRAM radice lcd displeje
.................... // Pro snadne definovani jsou pripraveny nasledujici definice a na konci souboru je uveden
.................... // priklad pouziti definovanych znaku.
....................
....................
.................... // Pomocna procedura pro posilani ridicich dat do radice displeje
.................... //
.................... void lcd_putc2(int Data)
.................... {
.................... lcd_send_byte(1,Data);
.................... }
....................
....................
.................... // Pomocne definice pro programovani obsahu CGRAM
.................... //
.................... #define lcd_define_start(Code) lcd_send_byte(0,0x40+(Code<<3)); delay_ms(2)
.................... #define lcd_define_def(String) printf(lcd_putc2,String);
.................... #define lcd_define_end() lcd_send_byte(0,3); delay_ms(2)
....................
....................
.................... // Vlastni vykonne makro pro definovani fontu do pozice Index CGRAM s definicnim retezcem Def
.................... //
.................... #define lcd_define_char(Index, Def) lcd_define_start(Index); lcd_define_def(Def); lcd_define_end();
....................
....................
.................... // Pripravene definice fontu vybranych znaku
.................... // V tabulce nesmi byt 00 (konec retezce v printf()), misto toho davame 80
.................... //
.................... #define LCD_CHAR_BAT100 "\x0E\x1F\x1F\x1F\x1F\x1F\x1F\x1F" /* symbol plne baterie */
.................... #define LCD_CHAR_BAT50 "\x0E\x1F\x11\x11\x13\x17\x1F\x1F" /* symbol polovicni baterie */
.................... #define LCD_CHAR_BAT0 "\x0E\x1F\x11\x11\x11\x11\x11\x1F" /* symbol vybite baterie */
.................... #define LCD_CHAR_UP "\x80\x04\x0E\x15\x04\x04\x04\x80" /* symbol sipka nahoru */
.................... #define LCD_CHAR_DOWN "\x80\x04\x04\x04\x15\x0E\x04\x80" /* symbol Sipka dolu */
.................... #define LCD_CHAR_LUA "\x04\x0E\x11\x11\x1F\x11\x11\x80" /* A s carkou */
.................... #define LCD_CHAR_LLA "\x01\x02\x0E\x01\x1F\x11\x0F\x80" /* a s carkou */
.................... #define LCD_CHAR_HUC "\x0A\x0E\x11\x10\x10\x11\x0E\x80" /* C s hackem */
.................... #define LCD_CHAR_HLC "\x0A\x04\x0E\x10\x10\x11\x0E\x80" /* c s hackem */
.................... #define LCD_CHAR_HUD "\x0A\x1C\x12\x11\x11\x12\x1C\x80" /* D s hackem */
.................... #define LCD_CHAR_HLD "\x05\x03\x0D\x13\x11\x11\x0F\x80" /* d s hackem */
.................... #define LCD_CHAR_LUE "\x04\x1F\x10\x10\x1E\x10\x1F\x80" /* E s carkou */
.................... #define LCD_CHAR_LLE "\x01\x02\x0E\x11\x1F\x10\x0E\x80" /* e s carkou */
.................... #define LCD_CHAR_HUE "\x0A\x1F\x10\x1E\x10\x10\x1F\x80" /* E s hackem */
.................... #define LCD_CHAR_HLE "\x0A\x04\x0E\x11\x1F\x10\x0E\x80" /* e s hackem */
.................... #define LCD_CHAR_LUI "\x04\x0E\x04\x04\x04\x04\x0E\x80" /* I s carkou */
.................... #define LCD_CHAR_LLI "\x02\x04\x80\x0C\x04\x04\x0E\x80" /* i s carkou */
.................... #define LCD_CHAR_HUN "\x0A\x15\x11\x19\x15\x13\x11\x80" /* N s hackem */
.................... #define LCD_CHAR_HLN "\x0A\x04\x16\x19\x11\x11\x11\x80" /* n s hackem */
.................... #define LCD_CHAR_LUO "\x04\x0E\x11\x11\x11\x11\x0E\x80" /* O s carkou */
.................... #define LCD_CHAR_LLO "\x02\x04\x0E\x11\x11\x11\x0E\x80" /* o s carkou */
.................... #define LCD_CHAR_HUR "\x0A\x1E\x11\x1E\x14\x12\x11\x80" /* R s hackem */
.................... #define LCD_CHAR_HLR "\x0A\x04\x16\x19\x10\x10\x10\x80" /* r s hackem */
.................... #define LCD_CHAR_HUS "\x0A\x0F\x10\x0E\x01\x01\x1E\x80" /* S s hackem */
.................... #define LCD_CHAR_HLS "\x0A\x04\x0E\x10\x0E\x01\x1E\x80" /* s s hackem */
.................... #define LCD_CHAR_HUT "\x0A\x1F\x04\x04\x04\x04\x04\x80" /* T s hackem */
.................... #define LCD_CHAR_HLT "\x0A\x0C\x1C\x08\x08\x09\x06\x80" /* t s hackem */
.................... #define LCD_CHAR_LUU "\x02\x15\x11\x11\x11\x11\x0E\x80" /* U s carkou */
.................... #define LCD_CHAR_LLU "\x02\x04\x11\x11\x11\x13\x0D\x80" /* u s carkou */
.................... #define LCD_CHAR_CUU "\x06\x17\x11\x11\x11\x11\x0E\x80" /* U s krouzkem */
.................... #define LCD_CHAR_CLU "\x06\x06\x11\x11\x11\x11\x0E\x80" /* u s krouzkem */
.................... #define LCD_CHAR_LUY "\x02\x15\x11\x0A\x04\x04\x04\x80" /* Y s carkou */
.................... #define LCD_CHAR_LLY "\x02\x04\x11\x11\x0F\x01\x0E\x80" /* y s carkou */
.................... #define LCD_CHAR_HUZ "\x0A\x1F\x01\x02\x04\x08\x1F\x80" /* Z s hackem */
.................... #define LCD_CHAR_HLZ "\x0A\x04\x1F\x02\x04\x08\x1F\x80" /* z s hackem */
....................
....................
.................... // Priklad pouziti definovanych znaku
.................... //
.................... //
.................... //void lcd_sample()
.................... //{
.................... // lcd_define_char(0,LCD_CHAR_BAT50); // Priklad definice znaku baterie do pozice 0
.................... // lcd_define_char(2,LCD_CHAR_HLE LCD_CHAR_LUI); // Priklad definice znaku e s hackem a I s carkou od pozice 2
.................... // // vsimnete si, ze neni carka mezi retezci s definici (oba retezce definuji
.................... // // jediny definicni retezec)
.................... // printf(lcd_putc,"\fZnaky:\20\22\23"); // priklad vypisu znaku z pozice 0, 2 a 3
.................... // delay_ms(1000);
.................... // lcd_define_char(0,LCD_CHAR_BAT0); // Predefinovani tvaru znaku v pozici 0
.................... // delay_ms(1000);
.................... //}
....................
....................
.................... #define DATA PIN_A1
.................... #define CP PIN_A0
.................... #define STROBE PIN_A2
....................
.................... #include "C:\library\kaklik\ccs\shift_reg.c"
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // definice:
.................... //#define DATA PIN_A1
.................... //#define CP PIN_A0
.................... //#define STROBE PIN_A2
....................
.................... void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
.................... {
.................... int8 i;
.................... output_low(STROBE);
....................
.................... for(i=0;i<=7;i++)
.................... {
.................... output_bit(DATA,bit_test(out,7-i));
.................... output_low(CP);
.................... output_high(CP);
.................... }
.................... output_high(STROBE);
.................... }
....................
.................... void reg_shift_left()
.................... {
.................... output_low(CP);
.................... output_high(CP);
....................
.................... }
....................
.................... void reg_shift_right()
.................... {
.................... }
....................
....................
.................... void main()
.................... {
*
0158: CLRF 04
0159: MOVLW 1F
015A: ANDWF 03,F
015B: BSF 03.5
015C: BSF 1F.0
015D: BSF 1F.1
015E: BSF 1F.2
015F: BCF 1F.3
.................... unsigned int16 otacky;
....................
.................... setup_adc_ports(NO_ANALOGS);
*
0163: BSF 03.5
0164: BSF 1F.0
0165: BSF 1F.1
0166: BSF 1F.2
0167: BCF 1F.3
.................... setup_adc(ADC_OFF);
0168: BCF 03.5
0169: BCF 1F.0
.................... setup_spi(FALSE);
*
0160: MOVLW FF
0161: BCF 03.5
0162: MOVWF 25
*
016A: BCF 14.5
016B: BCF 25.5
016C: MOVF 25,W
016D: BSF 03.5
016E: MOVWF 07
016F: BCF 03.5
0170: BSF 25.4
0171: MOVF 25,W
0172: BSF 03.5
0173: MOVWF 07
0174: BCF 03.5
0175: BCF 25.3
0176: MOVF 25,W
0177: BSF 03.5
0178: MOVWF 07
0179: MOVLW 00
017A: BCF 03.5
017B: MOVWF 14
017C: BSF 03.5
017D: MOVWF 14
.................... setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
017E: MOVF 01,W
017F: ANDLW C7
0180: IORLW 38
0181: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
0182: MOVLW 97
0183: BCF 03.5
0184: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
0185: MOVLW 00
0186: MOVWF 21
0187: MOVWF 12
0188: MOVLW 00
0189: BSF 03.5
018A: MOVWF 12
.................... setup_ccp1(CCP_PWM);
018B: BCF 03.5
018C: BCF 25.2
018D: MOVF 25,W
018E: BSF 03.5
018F: MOVWF 07
0190: BCF 03.5
0191: BCF 07.2
0192: MOVLW 0C
0193: MOVWF 17
.................... setup_ccp2(CCP_OFF);
0194: BSF 25.1
0195: MOVF 25,W
0196: BSF 03.5
0197: MOVWF 07
0198: BCF 03.5
0199: CLRF 1D
019A: CLRF 1D
....................
.................... lcd_init();
019B: GOTO 064
....................
.................... while (true)
.................... {
.................... set_timer1(0);
019C: CLRF 0F
019D: CLRF 0E
....................
.................... Delay_ms(500);
019E: MOVLW 02
019F: MOVWF 28
01A0: MOVLW FA
01A1: MOVWF 32
01A2: CALL 024
01A3: DECFSZ 28,F
01A4: GOTO 1A0
.................... otacky=get_timer1();
01A5: MOVF 0F,W
01A6: MOVWF 23
01A7: MOVF 0E,W
01A8: MOVWF 20
01A9: MOVF 0F,W
01AA: SUBWF 23,W
01AB: BTFSS 03.2
01AC: GOTO 1A5
01AD: MOVF 20,W
01AE: MOVWF 26
01AF: MOVF 23,W
01B0: MOVWF 27
.................... otacky=otacky*40;
01B1: MOVF 27,W
01B2: MOVWF 29
01B3: MOVF 26,W
01B4: MOVWF 28
01B5: CLRF 2B
01B6: MOVLW 28
01B7: MOVWF 2A
01B8: GOTO 09E
01B9: MOVF 22,W
01BA: MOVWF 27
01BB: MOVF 21,W
01BC: MOVWF 26
....................
.................... switch(otacky)
.................... {
01BD: MOVF 26,W
01BE: MOVWF 20
01BF: MOVF 27,W
01C0: MOVWF 23
01C1: GOTO 1C2
....................
.................... }
....................
.................... LCD_gotoxy(2,2);
01C2: MOVLW 02
01C3: MOVWF 32
01C4: MOVWF 33
01C5: CALL 0B4
.................... printf(lcd_putc,"otacky:%lu ot/min ",otacky);
01C6: CLRF 28
01C7: MOVF 28,W
01C8: CALL 00C
01C9: INCF 28,F
01CA: MOVWF 20
01CB: MOVWF 31
01CC: CALL 0C5
01CD: MOVLW 07
01CE: SUBWF 28,W
01CF: BTFSS 03.2
01D0: GOTO 1C7
01D1: MOVLW 10
01D2: MOVWF 04
01D3: MOVF 27,W
01D4: MOVWF 2A
01D5: MOVF 26,W
01D6: MOVWF 29
01D7: GOTO 0F8
01D8: MOVLW 0A
01D9: MOVWF 29
01DA: MOVF 29,W
01DB: CALL 00C
01DC: INCF 29,F
01DD: MOVWF 20
01DE: MOVWF 31
01DF: CALL 0C5
01E0: MOVLW 13
01E1: SUBWF 29,W
01E2: BTFSS 03.2
01E3: GOTO 1DA
.................... }
01E4: GOTO 19C
....................
.................... }
....................
01E5: SLEEP
 
Configuration Fuses:
Word 1: 3F79 XT NOWDT NOPUT NOPROTECT BROWNOUT NOLVP NOCPD NOWRT NODEBUG
/programy/C/PIC/mereni/otmer/16F873/otmer.PJT
0,0 → 1,39
[PROJECT]
Target=otmer.HEX
Development_Mode=
Processor=0x873F
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\drivers\;C:\library\CCS;
Library=
LinkerScript=
 
[Target Data]
FileList=otmer.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[otmer.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=otmer.c
 
[Windows]
0=0000 otmer.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
2=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
3=C:\Program Files\PICC\devices\16F873.h
4=D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
5=C:\library\kaklik\ccs\shift_reg.c
6=
/programy/C/PIC/mereni/otmer/16F873/otmer.SYM
0,0 → 1,75
015 CCP_1_LOW
015-016 CCP_1
016 CCP_1_HIGH
01B CCP_2_LOW
01B-01C CCP_2
01C CCP_2_HIGH
020 @SCRATCH
021 @SCRATCH
021 _RETURN_
022 @SCRATCH
023 @SCRATCH
024 @SCRATCH
025 @TRIS_C
026-027 main.otacky
028 lcd_init.i
028-029 @MUL1616.P1
028 main.@SCRATCH
029-02A @PRINTF_LU_263.P1
029 lcd_init.@SCRATCH
029 main.@SCRATCH
02A-02B @MUL1616.P1
02B @PRINTF_LU_263.@SCRATCH
02C @MUL1616.@SCRATCH
02C @PRINTF_LU_263.@SCRATCH
02D @PRINTF_LU_263.@SCRATCH
02E @PRINTF_LU_263.@SCRATCH
02F @PRINTF_LU_263.@SCRATCH
030 @PRINTF_LU_263.@SCRATCH
031 lcd_putc.c
032 @delay_ms1.P1
032 lcd_gotoxy.x
033 lcd_gotoxy.y
034 lcd_gotoxy.Adr
035 lcd_gotoxy.@SCRATCH
036 lcd_send_byte.Adr
037 lcd_send_byte.n
038 lcd_send_nibble.n
039 lcd_send_nibble.@SCRATCH
03A lcd_send_nibble.@SCRATCH
 
0024 @delay_ms1
0004 @const28
0039 lcd_send_nibble
004E lcd_send_byte
0064 lcd_init
00B4 lcd_gotoxy
00C5 lcd_putc
0158 main
009E @MUL1616
000C @const10134
00F8 @PRINTF_LU_263
0158 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
C:\Program Files\PICC\devices\16F873.h
D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
C:\library\kaklik\ccs\shift_reg.c
 
Compiler Settings:
Processor: PIC16F873
Pointer Size: 8
ADC Range: 0-255
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.sta
/programy/C/PIC/mereni/otmer/16F873/otmer.c
0,0 → 1,49
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
 
//Definice portu: // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
 
#define LCD_RS PIN_B1 // rizeni registru LCD displeje
#define LCD_E PIN_B0 // enable LCD displeje
#define LCD_DATA_LSB PIN_C4 // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
 
#include "LCD.C"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "C:\library\kaklik\ccs\shift_reg.c"
 
void main()
{
unsigned int16 otacky;
 
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_OFF);
 
lcd_init();
 
while (true)
{
set_timer1(0);
 
Delay_ms(500);
otacky=get_timer1();
otacky=otacky*40;
switch(otacky)
{
}
 
LCD_gotoxy(2,2);
printf(lcd_putc,"otacky:%lu ot/min ",otacky);
}
 
}
/programy/C/PIC/mereni/otmer/16F873/otmer.cof
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
/programy/C/PIC/mereni/otmer/16F873/otmer.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/otmer/16F873/otmer.h
0,0 → 1,5
#include <16F873.h>
#device adc=8
#fuses NOWDT,XT, NOPUT, NOPROTECT, BROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/otmer/16F873/otmer.sta
0,0 → 1,40
 
ROM used: 486 (12%)
486 (12%) including unused fragments
 
1 Average locations per line
7 Average locations per statement
 
RAM used: 10 (5%) at main() level
27 (14%) worst case
 
Lines Stmts % Files
----- ----- --- -----
50 18 24 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.c
6 0 0 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h
240 0 0 C:\Program Files\PICC\devices\16F873.h
312 47 51 D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\LCD.C
34 9 6 C:\library\kaklik\ccs\shift_reg.c
----- -----
1284 148 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 4 1 @delay_ms1
0 8 2 0 @const28
0 21 4 3 lcd_send_nibble
0 22 5 2 lcd_send_byte
0 58 12 2 lcd_init
0 17 3 4 lcd_gotoxy
0 51 10 1 lcd_putc
0 142 29 4 main
0 22 5 5 @MUL1616
0 24 5 0 @const10134
0 96 20 8 @PRINTF_LU_263
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-007FF 482 1562
00800-00FFF 0 2048
 
/programy/C/PIC/mereni/otmer/16F873/otmer.tre
0,0 → 1,98
ÀÄotmer
ÀÄmain 0/142 Ram=4
ÃÄ??0??
ÃÄlcd_init 0/58 Ram=2
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@const28 0/8 Ram=0
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄ@delay_ms1 0/21 Ram=1
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄ@MUL1616 0/22 Ram=5
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10134 0/24 Ram=0
ÃÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@PRINTF_LU_263 0/96 Ram=8
³ ÃÄlcd_putc 0/51 Ram=1
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄ@delay_ms1 0/21 Ram=1
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_putc 0/51 Ram=1
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄ@delay_ms1 0/21 Ram=1
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_gotoxy 0/17 Ram=4
³ ³ ÀÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÃÄlcd_send_byte 0/22 Ram=2
³ ³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ³ ÀÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@const10134 0/24 Ram=0
ÀÄlcd_putc 0/51 Ram=1
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_gotoxy 0/17 Ram=4
³ ÀÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÃÄlcd_send_byte 0/22 Ram=2
³ ÃÄlcd_send_nibble 0/21 Ram=3
³ ÀÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_byte 0/22 Ram=2
ÃÄlcd_send_nibble 0/21 Ram=3
ÀÄlcd_send_nibble 0/21 Ram=3
/programy/C/PIC/mereni/otmer/Kopie - otackomer.c
0,0 → 1,27
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otackomer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
 
void main()
{
int i;
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
 
while(true)
{
output_high(DATA);
output_high(CP);
Delay_ms(100);
output_low(CP);
output_low(DATA);
 
for(i=7;i>0;i--)
{
Delay_ms(100);
output_high(CP);
Delay_ms(100);
output_low(CP);
}
}
}
/programy/C/PIC/mereni/otmer/Kopie - otmer.c
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.BAK
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(~i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(~i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.HEX
0,0 → 1,19
:1000000000308A0044280000831605118312051170
:1000100093011308073C031C2A281308073C94008B
:1000200012088C0014088D0003191A2803108C0C78
:100030008D0B16280C181E2885101F288514831672
:100040008510051083120510831605108312051400
:10005000930A0928831605118312051500341130FF
:10006000840000080319432801308D008C018C0B9B
:1000700037288D0B36284A308C008C0B3D28000029
:100080000000800B3428003484011F3083058F0169
:10009000013092000420013090008F010F08073CCE
:1000A000031C5C281008920004200310900D3230CD
:1000B00091002F208F0A4E28803090008F010F086A
:1000C000073C031C6D281008920004200310900CBC
:1000D000323091002F208F0A5F284B280F089100A3
:1000E0009109110892000420643091002F208F0A9A
:0400F0006E28630013
:02400E00F93F78
:00000001FF
;PIC16F84
/programy/C/PIC/mereni/otmer/otmer.LST
0,0 → 1,216
CCS PCM C Compiler, Version 3.221, 27853 14-VI-05 22:12
 
Filename: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.LST
 
ROM used: 122 words (12%)
Largest free fragment is 902
RAM used: 5 (7%) at main() level
8 (12%) worst case
Stack: 1 locations
 
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 044
0003: NOP
.................... #include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
.................... #include <16F84.h>
.................... //////// Standard Header file for the PIC16F84 device ////////////////
.................... #device PIC16F84
.................... #list
....................
.................... #fuses NOWDT,XT, NOPUT, NOPROTECT
.................... #use delay(clock=4000000)
*
002F: MOVLW 11
0030: MOVWF 04
0031: MOVF 00,W
0032: BTFSC 03.2
0033: GOTO 043
0034: MOVLW 01
0035: MOVWF 0D
0036: CLRF 0C
0037: DECFSZ 0C,F
0038: GOTO 037
0039: DECFSZ 0D,F
003A: GOTO 036
003B: MOVLW 4A
003C: MOVWF 0C
003D: DECFSZ 0C,F
003E: GOTO 03D
003F: NOP
0040: NOP
0041: DECFSZ 00,F
0042: GOTO 034
0043: RETLW 00
....................
....................
....................
.................... #define DATA PIN_A1
.................... #define CP PIN_A0
.................... #define STROBE PIN_A2
....................
.................... #include "shift_reg.c"
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
.................... //
.................... ////////////////////////////////////////////////////////////////////////////////
.................... // definice
.................... //#define DATA PIN_A1
.................... //#define CP PIN_A0
.................... //#define STROBE PIN_A2
....................
.................... void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
.................... {
.................... int8 i;
.................... output_low(STROBE);
*
0004: BSF 03.5
0005: BCF 05.2
0006: BCF 03.5
0007: BCF 05.2
....................
.................... for(i=0;i<=7;i++)
0008: CLRF 13
0009: MOVF 13,W
000A: SUBLW 07
000B: BTFSS 03.0
000C: GOTO 02A
.................... {
.................... output_bit(DATA,bit_test(out,7-i));
000D: MOVF 13,W
000E: SUBLW 07
000F: MOVWF 14
0010: MOVF 12,W
0011: MOVWF 0C
0012: MOVF 14,W
0013: MOVWF 0D
0014: BTFSC 03.2
0015: GOTO 01A
0016: BCF 03.0
0017: RRF 0C,F
0018: DECFSZ 0D,F
0019: GOTO 016
001A: BTFSC 0C.0
001B: GOTO 01E
001C: BCF 05.1
001D: GOTO 01F
001E: BSF 05.1
001F: BSF 03.5
0020: BCF 05.1
.................... output_low(CP);
0021: BCF 05.0
0022: BCF 03.5
0023: BCF 05.0
.................... output_high(CP);
0024: BSF 03.5
0025: BCF 05.0
0026: BCF 03.5
0027: BSF 05.0
.................... }
0028: INCF 13,F
0029: GOTO 009
.................... output_high(STROBE);
002A: BSF 03.5
002B: BCF 05.2
002C: BCF 03.5
002D: BSF 05.2
.................... }
002E: RETLW 00
.................... void reg_shift_left()
.................... {
.................... }
.................... void reg_shift_right()
.................... {
.................... }
....................
....................
.................... void main()
.................... {
*
0044: CLRF 04
0045: MOVLW 1F
0046: ANDWF 03,F
.................... int n=0;
0047: CLRF 0F
.................... int i;
.................... putreg(1);
0048: MOVLW 01
0049: MOVWF 12
004A: CALL 004
.................... while(true)
.................... {
.................... i=1;
004B: MOVLW 01
004C: MOVWF 10
.................... for(n=0;n<=7;n++)
004D: CLRF 0F
004E: MOVF 0F,W
004F: SUBLW 07
0050: BTFSS 03.0
0051: GOTO 05C
.................... {
.................... putreg(i);
0052: MOVF 10,W
0053: MOVWF 12
0054: CALL 004
.................... i=i<<1;
0055: BCF 03.0
0056: RLF 10,F
.................... Delay_ms(50);
0057: MOVLW 32
0058: MOVWF 11
0059: CALL 02F
.................... };
005A: INCF 0F,F
005B: GOTO 04E
.................... i=0x80;
005C: MOVLW 80
005D: MOVWF 10
.................... for(n=0;n<=7;n++)
005E: CLRF 0F
005F: MOVF 0F,W
0060: SUBLW 07
0061: BTFSS 03.0
0062: GOTO 06D
.................... {
.................... putreg(i);
0063: MOVF 10,W
0064: MOVWF 12
0065: CALL 004
.................... i=i>>1;
0066: BCF 03.0
0067: RRF 10,F
.................... Delay_ms(50);
0068: MOVLW 32
0069: MOVWF 11
006A: CALL 02F
.................... };
006B: INCF 0F,F
006C: GOTO 05F
.................... }
006D: GOTO 04B
....................
.................... while(true)
.................... {
.................... putreg(~n);
006E: MOVF 0F,W
006F: MOVWF 11
0070: COMF 11,F
0071: MOVF 11,W
0072: MOVWF 12
0073: CALL 004
.................... Delay_ms(100);
0074: MOVLW 64
0075: MOVWF 11
0076: CALL 02F
.................... n++;
0077: INCF 0F,F
.................... }
0078: GOTO 06E
.................... }
....................
0079: SLEEP
 
Configuration Fuses:
Word 1: 3FF9 XT NOWDT NOPUT NOPROTECT
/programy/C/PIC/mereni/otmer/otmer.PJT
0,0 → 1,38
[PROJECT]
Target=otmer.HEX
Development_Mode=
Processor=0x684A
ToolSuite=CCS
 
[Directories]
Include=C:\Program Files\PICC\devices\;C:\Program Files\PICC\dr
Library=
LinkerScript=
 
[Target Data]
FileList=otmer.c;
BuildTool=C-COMPILER
OptionString=+FM
AdditionalOptionString=
BuildRequired=1
 
[otmer.c]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
 
[mru-list]
1=otmer.c
 
[Windows]
0=0000 otmer.c 0 0 796 451 3 0
 
[Opened Files]
1=D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
2=D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
3=C:\Program Files\PICC\devices\16F84.h
4=
5=
/programy/C/PIC/mereni/otmer/otmer.SYM
0,0 → 1,36
00C @SCRATCH
00D @SCRATCH
00D _RETURN_
00F main.n
010 main.i
011 @delay_ms1.P1
011 main.@SCRATCH
012 putreg.out
013 putreg.i
014 putreg.@SCRATCH
 
002F @delay_ms1
0004 putreg
0044 main
0044 @cinit
 
Project Files:
D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
C:\Program Files\PICC\devices\16F84.h
D:\KAKLIK\programy\PIC_C\mereni\otmer\shift_reg.c
 
Compiler Settings:
Processor: PIC16F84
Pointer Size: 8
Opt Level: 9
Short,Int,Long: 1,8,16
 
Output Files:
Errors: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.err
INHX8: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.HEX
Symbols: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.SYM
List: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.LST
Debug/COFF: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.cof
Call Tree: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.tre
Statistics: D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.sta
/programy/C/PIC/mereni/otmer/otmer.c
0,0 → 1,38
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h"
 
#define DATA PIN_A1
#define CP PIN_A0
#define STROBE PIN_A2
 
#include "shift_reg.c"
 
void main()
{
int n=0;
int i;
putreg(1);
while(true)
{
i=1;
for(n=0;n<=7;n++)
{
putreg(i);
i=i<<1;
Delay_ms(50);
};
i=0x80;
for(n=0;n<=7;n++)
{
putreg(i);
i=i>>1;
Delay_ms(50);
};
}
 
while(true)
{
putreg(~n);
Delay_ms(100);
n++;
}
}
/programy/C/PIC/mereni/otmer/otmer.cof
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
/programy/C/PIC/mereni/otmer/otmer.err
0,0 → 1,0
No Errors
/programy/C/PIC/mereni/otmer/otmer.h
0,0 → 1,4
#include <16F84.h>
#fuses NOWDT,XT, NOPUT, NOPROTECT
#use delay(clock=4000000)
 
/programy/C/PIC/mereni/otmer/otmer.sta
0,0 → 1,30
 
ROM used: 122 (12%)
122 (12%) including unused fragments
 
1 Average locations per line
4 Average locations per statement
 
RAM used: 5 (7%) at main() level
8 (12%) worst case
 
Lines Stmts % Files
----- ----- --- -----
39 22 76 D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.c
5 0 0 D:\KAKLIK\programy\PIC_C\mereni\otmer\otmer.h
111 0 0 C:\Program Files\PICC\devices\16F84.h
29 7 14 D:\KAKLIK\programy\PIC_C\mereni\otmer\shift_reg.c
----- -----
368 58 Total
 
Page ROM % RAM Functions:
---- --- --- --- ----------
0 21 17 1 @delay_ms1
0 43 35 3 putreg
0 54 44 3 main
 
Segment Used Free
--------- ---- ----
00000-00003 4 0
00004-003FF 118 902
 
/programy/C/PIC/mereni/otmer/otmer.tre
0,0 → 1,10
ÀÄotmer
ÀÄmain 0/54 Ram=3
ÃÄ??0??
ÃÄputreg 0/43 Ram=3
ÃÄputreg 0/43 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄputreg 0/43 Ram=3
ÃÄ@delay_ms1 0/21 Ram=1
ÃÄputreg 0/43 Ram=3
ÀÄ@delay_ms1 0/21 Ram=1
/programy/C/PIC/mereni/otmer/shift_reg.BAK
0,0 → 1,22
////////////////////////////////////////////////////////////////////////////////
// KNIHOVNA PRO OVLADANI POSUVNEHO REGISTRU
//
////////////////////////////////////////////////////////////////////////////////
// definice
//#define DATA PIN_A1
//#define CP PIN_A0
//#define STROBE PIN_A2
 
void putreg(unsigned int8 out) // zapise do registru 8bitovou promenou.
{
int8 i;
output_low(STROBE);
for(i=0;i<=7;i++)
{
output_bit(DATA,bit_test(out,7-i));
output_low(CP);
output_high(CP);
}
output_high(STROBE);
}
/programy/C/PIC/mereni/otmer/vssver.scc
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