You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.6 KiB
107 lines
2.6 KiB
//////////////////////////////////////////////////////////////////////////
|
|
/// COPYRIGHT NOTICE
|
|
/// Copyright (c) 2023, 传控科技
|
|
/// All rights reserved.
|
|
///
|
|
/// @file asp_move.c
|
|
/// @brief asp_move
|
|
///
|
|
///(本文件实现的功能的详述)
|
|
/// moved的任务调度,是角度传感器和限位开关、的上层
|
|
/// moto工作 限位开关限位 角度传感器指示位置
|
|
///move--|--adc
|
|
/// |--key
|
|
/// |--moto
|
|
#include "asp_expara.h"
|
|
#include "msp_UART1.h"
|
|
#include "asp_move.h"
|
|
#include "msp_adc.h"
|
|
|
|
TS_EXPARA_ ts_expara;
|
|
|
|
void L1_expara_init(unsigned char onf)
|
|
{
|
|
if (onf)
|
|
{
|
|
L0_ADC_init(1);
|
|
TTSS_run_every_init(ts_expara.vref.n, D_sample_vref_interval);
|
|
|
|
TTSS_run_every_init(ts_expara.vbat.n, D_sample_vbat_interval);
|
|
TTSS_run_every_init(ts_expara.angle.n, D_sample_angle_interval);
|
|
TTSS_run_every_init(ts_expara.pt.n, D_sample_pt_interval);
|
|
ts_expara.vbat.en = 1;
|
|
ts_expara.angle.en = 1;
|
|
ts_expara.pt.en = 1;
|
|
ts_expara.vref.en = 1;
|
|
D_VCC_BAT_ON();
|
|
D_SW_CAL_ON();
|
|
SWITCH_INIT();
|
|
}else
|
|
{
|
|
///close adc
|
|
}
|
|
}
|
|
|
|
void L1_expara_sample(void)
|
|
{
|
|
if(ts_expara.vbat.en)
|
|
{
|
|
TTSS_run_every(ts_expara.vbat.n,D_sample_vbat_interval)
|
|
ts_expara.vbat.val = L1_ADC_Readx(D_sample_adc_vbat);
|
|
///
|
|
|
|
TTSS_run_every_end
|
|
}
|
|
|
|
if(ts_expara.angle.en)
|
|
{
|
|
TTSS_run_every(ts_expara.angle.n,D_sample_angle_interval)
|
|
ts_expara.angle.val = L1_ADC_Readx(D_sample_adc_angle);
|
|
///printf1(" vbat= %d %x",ts_expara.vbat.val);
|
|
ts_task_move.loc_now = ts_expara.angle.val;///
|
|
|
|
|
|
|
|
TTSS_run_every_end
|
|
}
|
|
if(ts_expara.vref.en)
|
|
{
|
|
TTSS_run_every(ts_expara.vref.n,D_sample_vref_interval)
|
|
ts_expara.vref.val = L1_ADC_Readx(D_sample_adc_vref);
|
|
///printf1(" pt= %d %x",ts_expara.vbat.val);
|
|
|
|
TTSS_run_every_end
|
|
}
|
|
|
|
if(ts_expara.pt.en)
|
|
{
|
|
TTSS_run_every(ts_expara.pt.n,D_sample_pt_interval)
|
|
ts_expara.pt.val = L1_ADC_Readx(D_sample_adc_pt);
|
|
///printf1(" pt= %d %x",ts_expara.vbat.val);
|
|
|
|
|
|
printf4("%d\t%d\t%d\t%d\r\n",ts_expara.vref.val,ts_expara.vbat.val,ts_expara.angle.val,ts_expara.pt.val);
|
|
TTSS_run_every_end
|
|
}
|
|
|
|
|
|
}
|
|
|
|
#if 0
|
|
L0_uart1_sendstr("IMEI");
|
|
L1_uartD_uchexArray(&R.card,16);
|
|
L0_uart1_0d0a();
|
|
L3_GET_ANGLE(L1_ADC_Read_ANGLE(6));
|
|
printf2("\r\n SET_ANGLE: %x CUR_ANGLE:%x \r\n",(int)R.motor_angle_set,(int)R.motor_angle_cur);
|
|
L3_GET_TEMP(L1_ADC_Read_PT(7));
|
|
printf2("\r\n IN_TEMP:%x BACK_TEMP: %x \r\n",(int)R.in_temp,(int)R.back_temp);
|
|
L3_GET_VBAT(L1_ADC_Read_VBAT(5));
|
|
L1_as_readA(0);
|
|
printf3("\r\n X_AXIS:%x Y_AXIS: %x Z_AXIS:%x\r\n",(int)R.x_acc,(int)R.y_acc,(int)R.z_acc);
|
|
L1_read_time();
|
|
printf1("\r\n NET_STREN:%x \r\n",R.signal);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|