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.
152 lines
2.7 KiB
152 lines
2.7 KiB
1 year ago
|
////////////////////////////////////////////////////////////////////////////
|
||
|
///@copyright Copyright (c) 2018, 传控科技 All rights reserved.
|
||
|
///-------------------------------------------------------------------------
|
||
|
/// @file bsp_drv.h
|
||
|
/// @brief bsp @ driver config
|
||
|
///-------------------------------------------------------------------------
|
||
|
/// @version 1.0
|
||
|
/// @author CC
|
||
|
/// @date 20220109
|
||
|
/// @note cc_AS_stc02
|
||
|
|
||
|
|
||
|
/*******************
|
||
|
xxx.x
|
||
|
Layer4: send/show
|
||
|
|
||
|
write to buffer -->send
|
||
|
|
||
|
-----------------------------
|
||
|
|
||
|
weight = cal(adc32)
|
||
|
|
||
|
Layer3: app weight
|
||
|
|
||
|
|
||
|
tst_weight.adc32 = ts_adc_samples[0].out5;
|
||
|
选择曲线 line
|
||
|
|
||
|
单路到多路
|
||
|
-----------------------------
|
||
|
out3 滤波啊
|
||
|
out2 滤波啊
|
||
|
|
||
|
Layer2: asp asp_adc
|
||
|
|
||
|
out1 读取adc
|
||
|
|
||
|
-------------------------
|
||
|
void L0_ADS1231_readCH2(vtype ch,vU16 *d)
|
||
|
|
||
|
Layer1: bsp: bsp_cs1232 最底层的adc的采样
|
||
|
|
||
|
*******************/
|
||
|
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#ifndef _APP_WEIGHT_H
|
||
|
#define _APP_WEIGHT_H
|
||
|
|
||
|
#include "TTSS_task.h"
|
||
|
#include "c_lib.h"
|
||
|
#include "asp_schain.h"
|
||
|
#include "tpc_debug.h"
|
||
|
|
||
|
#include "../bsp/bsp_config.h"
|
||
|
#include "msp_uart0.h"
|
||
|
#include "../bsp/bsp_cs1232.h"
|
||
|
/////水一般是18-19升,再加上桶,就是大约20公斤
|
||
|
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
vU16 kg;
|
||
|
vU16 adc; ///kg 对应的adc的采样值
|
||
|
|
||
|
}ts_weight_sheet_;///8Bytes
|
||
|
|
||
|
typedef struct
|
||
|
{
|
||
|
TS_task task;
|
||
|
vS32 rough_weight;
|
||
|
vU32 adc32;
|
||
|
vU32 sum32;
|
||
|
vU32 sum32b;
|
||
|
vU32 out6;
|
||
|
vU32 t32a,t32b;
|
||
|
/// ts_weight_sheet_
|
||
|
u8 slow;
|
||
|
u8 zero;
|
||
|
u8 pp;
|
||
|
vU16 woutx10;///计算出来的重量
|
||
|
ts_weight_sheet_ ws[3];
|
||
|
|
||
|
}TS_TASK_weight_;
|
||
|
extern TS_TASK_weight_ tst_weight;
|
||
|
|
||
|
|
||
|
/*******
|
||
|
^
|
||
|
|
|
||
|
| o
|
||
|
| |
|
||
|
| o |
|
||
|
| | |
|
||
|
o | |
|
||
|
| | |
|
||
|
|____|_____|____________>
|
||
|
|
||
|
0 40 80
|
||
|
[0] [1] [2]
|
||
|
20KG 40kg
|
||
|
190 290
|
||
|
19kg 29kg
|
||
|
|
||
|
|
||
|
上电时候 ,如果adc在一定范围内 自动清零
|
||
|
出厂:0 40 80
|
||
|
上电 0+-% 40+-% 80+-%
|
||
|
|
||
|
/// ts_weight_sheet_ factory_ws[3]; ///出厂的设置,发布出厂指令后更新 由上位机命令更改,实时保存
|
||
|
0,0x1235,
|
||
|
D_20kg,0x5678,
|
||
|
D_40kg,0x789a,
|
||
|
/// ts_weight_sheet_ zerows[3]; ///手工清零后的参数, 没有清零或者出错恢复到和出厂设置一样,需要实时保存
|
||
|
0,0x1234,
|
||
|
D_20kg,0x5678,
|
||
|
D_40kg,0x789b,
|
||
|
|
||
|
factory_ws
|
||
|
0 kg = 0x1235
|
||
|
190 kg = 0x5678
|
||
|
290 kg = 0x789a
|
||
|
|
||
|
zerows
|
||
|
0 kg = 0x1234
|
||
|
190 kg = 0x5678
|
||
|
290 kg = 0x789b
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
**/
|
||
|
|
||
|
|
||
|
////
|
||
|
extern void L3_task_weight_cal(void);
|
||
|
extern void L3_task_weight_init(void);
|
||
|
extern void L3_task_weight_handler(TS_TASK_weight_ *s);
|
||
|
///extern void L3_task_weight_set(Ts_uart_rev_ *ph4);
|
||
|
|
||
|
#define D_cmd_filter 0xfd
|
||
|
|
||
|
extern void L3_weight_setPara(u8 filter);
|
||
|
|
||
|
#define D_get_weight() tst_weight.woutx10
|
||
|
|
||
|
|
||
|
|
||
|
#endif // #ifndef _APP_TASK_ADC_H
|
||
|
|