User Tools

Site Tools


en:mag_subsys

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:mag_subsys [2020/01/20 09:15]
golikov
en:mag_subsys [2020/03/25 16:28] (current)
Line 16: Line 16:
  
 As would be the case with real-world spacecraft, magnetometer readings inside Orbicraft are not determined exclusively by the external geomagnetic field. Other instruments (mainly including reaction wheel motors and the power supply system) can interfere with readings. For that reason it is not recommended that the magnetometer be located immediately next to those devices. As would be the case with real-world spacecraft, magnetometer readings inside Orbicraft are not determined exclusively by the external geomagnetic field. Other instruments (mainly including reaction wheel motors and the power supply system) can interfere with readings. For that reason it is not recommended that the magnetometer be located immediately next to those devices.
 +
 +==== Magnetometer Test Code in C ====
 +
 +<file c mag_test.c>​
 +#define LSS_OK 0 
 +#define LSS_ERROR 1 
 +#define LSS_BREAK 2
 +
 +#include <​stdio.h>​
 +#include <​stdint.h>​
 +#include "​libschsat.h"​
 +int control() // Основная функция программы,​ в которой вызываем остальные функции
 +{
 + int16_t mgn_result[] = {0,0,0,0}; // Инициализируем mgn_result
 + uint16_t num = 1; // номер магнитометра
 + int i;
 + printf("​Rnable magnetometer №%d\n",​ num);
 + magnetometer_turn_on(num);​
 + Sleep(1);
 + printf("​Get RAW data from magnetometer\n"​);​
 + for (i = 0; i < 1000; i++)
 + {
 + mgn_result[0] = magnetometer_request_raw(num,&​ mgn_result[1],&​ mgn_result[2],&​ mgn_result[3]);​
 + if (!mgn_result[0])//​ если датчик вернул сообщение об ошибке,​
 + {
 + printf("​\nstate:​%d,​ \nx_raw =%d,\ny_raw =%d, \nz_raw =%d\n",​i,​ mgn_result[1],​ mgn_result[2],​ mgn_result[3]);​ //​Обратите внимание на символ переноса строки!
 + }
 + else if (mgn_result[0] == 1){
 + printf("​Fail because of access error, check the connection"​);​
 + }
 + else if (mgn_result[0] == 2){
 + printf("​Fail because of interdace error, check your code"​);​
 + }
 + Sleep(0.1);​
 + }
 + printf("​Disable magnetometer №%d\n",​ num);
 + magnetometer_turn_off(num);​
 + return 0;
 +}
 +</​file>​
  
  
en/mag_subsys.txt · Last modified: 2020/03/25 16:28 (external edit)