1045 |
jacho |
1 |
#include "C:\Users\Honza\Documents\pic\serio_tlak\pic\main.h" |
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
/**** Automatic weather station 01A ****/ |
|
|
6 |
#define VERSION "0.1" |
|
|
7 |
|
|
|
8 |
#define ID "$Id: main.c 2858 2013-03-22 16:04:13Z kaklik $" |
|
|
9 |
#include <string.h> |
|
|
10 |
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8) //rcv TXD xmit RXD |
|
|
11 |
|
|
|
12 |
#CASE // Case sensitive compiler |
|
|
13 |
|
|
|
14 |
#define SEND_DELAY 50 // Time between two characters on RS232 |
|
|
15 |
|
|
|
16 |
#define CSN_SPI PIN_C2 // preassure sensor connection |
|
|
17 |
#include "..\MPL115A1.c" |
|
|
18 |
|
|
|
19 |
void welcome(void) // Welcome message |
|
|
20 |
{ |
|
|
21 |
char REV[50]=ID; // Buffer for concatenate of a version string |
|
|
22 |
|
|
|
23 |
if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0; |
|
|
24 |
|
|
|
25 |
printf("# ver seq temp[mK] hum_temp[mK] hum[%%] "); |
|
|
26 |
printf("bar_temp[mK] pressure[hPa] Anemo[pls/s]check\r\n\r\n"); |
|
|
27 |
} |
|
|
28 |
|
|
|
29 |
void main() |
|
|
30 |
{ |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
setup_oscillator(OSC_8MHZ); // pri prouziti bootloaderu neni treba nastavovat |
|
|
34 |
setup_wdt(WDT_2304MS); |
|
|
35 |
restart_wdt(); //---WDT |
|
|
36 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
37 |
setup_adc(ADC_CLOCK_DIV_2); |
|
|
38 |
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); |
|
|
39 |
// setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);//|T1_CLK_OUT); |
|
|
40 |
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); |
|
|
41 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
42 |
setup_ccp1(CCP_OFF); |
|
|
43 |
setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard |
|
|
44 |
//setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); |
|
|
45 |
output_high(CSN_SPI); |
|
|
46 |
|
|
|
47 |
welcome(); // welcome print and device indentification |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
} |
|
|
51 |
|