2926 |
jacho |
1 |
#include "main.h" |
|
|
2 |
#include "HMC5883L.h" |
|
|
3 |
|
|
|
4 |
void main() |
|
|
5 |
{ |
2984 |
kaklik |
6 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
7 |
setup_adc(ADC_CLOCK_DIV_2); |
|
|
8 |
setup_spi(SPI_SS_DISABLED); |
|
|
9 |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
10 |
setup_timer_1(T1_DISABLED); |
|
|
11 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
12 |
setup_ccp1(CCP_OFF); |
|
|
13 |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
2926 |
jacho |
14 |
|
2984 |
kaklik |
15 |
printf("Magnetometr: \r\n",); |
|
|
16 |
printf("(c)mlab JACHO 2013: \r\n",); |
|
|
17 |
printf("Vysledky z jednotlivych os:\r\n",); |
|
|
18 |
signed int16 X,Y,Z; |
2926 |
jacho |
19 |
|
2984 |
kaklik |
20 |
while(true) |
|
|
21 |
{ |
|
|
22 |
printf("Vysledky z jednotlivych os:\r\n",); |
|
|
23 |
X = mag_readX(); |
|
|
24 |
Y = mag_readY(); |
|
|
25 |
Z = mag_readZ(); |
|
|
26 |
printf("X: %Ld \r\n", X); |
|
|
27 |
printf("Y %Ld \r\n", Y); |
|
|
28 |
printf("Z: %Ld \r\n", Z); |
|
|
29 |
Delay_ms(500); |
2926 |
jacho |
30 |
|
2984 |
kaklik |
31 |
} |
2926 |
jacho |
32 |
} |