Subversion Repositories svnkaklik

Rev

Rev 410 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 410 Rev 659
1
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
1
#include "D:\KAKLIK\programy\PIC_C\mereni\otmer\16F873\otmer.h"
2
 
2
 
3
//Definice portu:                     // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
3
//Definice portu:                     // Datovy port displeje pripojeny na 4 bity za sebou na jeden port
4
 
4
 
5
#define LCD_RS          PIN_B1      // rizeni registru LCD displeje
5
#define LCD_RS          PIN_B1      // rizeni registru LCD displeje
6
#define LCD_E           PIN_B0      // enable LCD displeje
6
#define LCD_E           PIN_B0      // enable LCD displeje
7
#define LCD_DATA_LSB    PIN_C4      // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
7
#define LCD_DATA_LSB    PIN_C4      // pripojeni LSB bitu datoveho portu LCD displeje (celkem 4 bity vzestupne za sebou)
8
 
8
 
9
#include "LCD.C"
9
#include "LCD.C"
10
 
10
 
11
#define DATA   PIN_A1
11
#define DATA   PIN_A1
12
#define CP     PIN_A0
12
#define CP     PIN_A0
13
#define STROBE PIN_A2
13
#define STROBE PIN_A2
14
 
14
 
15
#include "C:\library\kaklik\ccs\shift_reg.c"
15
#include "C:\library\kaklik\ccs\shift_reg.c"
16
 
16
 
17
void main()
17
void main()
18
{
18
{
19
unsigned int16 otacky;
19
unsigned int16 otacky;
20
 
20
 
21
   setup_adc_ports(NO_ANALOGS);
21
   setup_adc_ports(NO_ANALOGS);
22
   setup_adc(ADC_OFF);
22
   setup_adc(ADC_OFF);
23
   setup_spi(FALSE);
23
   setup_spi(FALSE);
24
   setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
24
   setup_timer_0(RTCC_EXT_H_TO_L|RTCC_DIV_1);
25
   setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
25
   setup_timer_1(T1_EXTERNAL|T1_DIV_BY_2);
26
   setup_timer_2(T2_DISABLED,0,1);
26
   setup_timer_2(T2_DISABLED,0,1);
27
   setup_ccp1(CCP_PWM);
27
   setup_ccp1(CCP_PWM);
28
   setup_ccp2(CCP_OFF);
28
   setup_ccp2(CCP_OFF);
29
 
29
 
30
   lcd_init();
30
   lcd_init();
31
 
31
 
32
   while (true)
32
   while (true)
33
   {
33
   {
34
      set_timer1(0);
34
      set_timer1(0);
35
 
35
 
36
      Delay_ms(500);
36
      Delay_ms(500);
37
      otacky=get_timer1();
37
      otacky=get_timer1();
38
      otacky=otacky*40;
38
      otacky=otacky*40;
39
 
39
 
40
      LCD_gotoxy(2,2);
40
      LCD_gotoxy(2,2);
41
      printf(lcd_putc,"otacky:%lu ot/min  ",otacky);
41
      printf(lcd_putc,"otacky:%lu ot/min  ",otacky);
42
   }
42
   }
43
 
43
 
44
}
44
}