3352 |
kaklik |
1 |
#include "main.h" |
|
|
2 |
|
|
|
3 |
#define LCD_ENABLE_PIN PIN_E0 //// |
|
|
4 |
#define LCD_RS_PIN PIN_E1 //// |
|
|
5 |
#define LCD_RW_PIN PIN_E2 //// |
|
|
6 |
#define LCD_DATA4 PIN_D4 //// |
|
|
7 |
#define LCD_DATA5 PIN_D5 //// |
|
|
8 |
#define LCD_DATA6 PIN_D6 //// |
|
|
9 |
#define LCD_DATA7 PIN_D7 |
|
|
10 |
#include <lcd.c> |
|
|
11 |
|
3632 |
jacho |
12 |
#define BEEPER PIN_B5 |
|
|
13 |
|
|
|
14 |
int beep() |
|
|
15 |
{ |
|
|
16 |
unsigned int i; |
|
|
17 |
|
|
|
18 |
i=0; |
|
|
19 |
for(i=0;i<100;i++) |
|
|
20 |
{ |
|
|
21 |
output_low(BEEPER); |
|
|
22 |
delay_ms(1); |
|
|
23 |
output_high(BEEPER); |
|
|
24 |
delay_ms(1); |
|
|
25 |
} |
|
|
26 |
} |
|
|
27 |
|
|
|
28 |
|
3352 |
kaklik |
29 |
void main() |
|
|
30 |
{ |
|
|
31 |
int16 i=0; |
|
|
32 |
|
|
|
33 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
34 |
setup_adc(ADC_CLOCK_DIV_2); |
|
|
35 |
setup_spi(SPI_SS_DISABLED); |
|
|
36 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
37 |
setup_timer_1(T1_DISABLED); |
|
|
38 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
39 |
setup_ccp1(CCP_OFF); |
|
|
40 |
setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
|
|
41 |
setup_oscillator(OSC_8MHZ); |
|
|
42 |
|
|
|
43 |
lcd_init(); |
|
|
44 |
lcd_putc("(c) Kaklik 2013"); |
|
|
45 |
lcd_gotoxy(3,2); |
|
|
46 |
lcd_putc("www.mlab.cz"); |
|
|
47 |
Delay_ms(2000); |
|
|
48 |
lcd_init(); |
|
|
49 |
|
|
|
50 |
while (TRUE) |
|
|
51 |
{ |
|
|
52 |
lcd_gotoxy(1,1); |
|
|
53 |
|
|
|
54 |
printf(lcd_putc,"LCD test"); |
|
|
55 |
lcd_gotoxy(1,2); |
|
|
56 |
printf(lcd_putc,"%c %x ",i,i); |
|
|
57 |
i++; |
3632 |
jacho |
58 |
beep(); |
3352 |
kaklik |
59 |
Delay_ms(500); |
|
|
60 |
} |
|
|
61 |
|
|
|
62 |
} |