8,7 → 8,6 |
unsigned int16 anemo_round=0; |
unsigned int16 i; |
|
|
//signed int16 X,Y,Z; |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_CLOCK_DIV_2); |
19,6 → 18,11 |
setup_ccp1(CCP_OFF); |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
|
printf("Magnetometr: \r\n",); |
printf("(c)mlab JACHO 2013: \r\n",); |
printf("X, Y, Z \r\n",); |
|
|
// Init the HMC5883L. Set Mode register for |
// continuous measurements. |
hmc5883l_write_reg(HMC5883L_CFG_A_REG, 0x18); // no average, maximal update range |
29,40 → 33,12 |
// Wait at least 67 ms between reads, re the HMC5883L data sheet. |
|
|
printf("Magnetometr: \r\n",); |
printf("(c)mlab JACHO 2013: \r\n",); |
printf("X, Y, Z \r\n",); |
|
/* while(true) |
{ |
X = mag_readX(); |
Y = mag_readY(); |
Z = mag_readZ(); |
printf("%4Ld %4Ld %4Ld \r\n", X, Y, Z); |
Delay_ms(50); |
|
} |
*/ |
|
while(TRUE) |
{ |
|
// for(i=0;i<=10;i++) |
// { |
hmc5883l_read_data(); |
|
// b = atan2((float)compass.y,(float)compass.x); // vypocet azimutu z kartezskych souradnic |
// b = (b/3.141596)*180; // prevod na stupne |
// b += 180; |
|
// anemo_speed += (b-last); |
// last=b; |
// delay_ms(10); |
// } |
// anemo_speed=anemo_speed/10; |
|
printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z); |
// delay_ms(100); |
hmc5883l_read_data(); |
printf("%6Ld %6Ld %6Ld \n\r", compass.x, compass.y, compass.z); |
delay_ms(100); |
} |
|
} |