Датчики объема. Адреса CAN + 0x80

This commit is contained in:
2025-07-28 18:14:03 +03:00
parent 6d250bb68a
commit 111ec362b4
12 changed files with 774 additions and 791 deletions

View File

@@ -16,7 +16,6 @@
float ADC_table[ADC_MAX];
int prev_ok[ADC_MAX];
int ADC_skip[TPL_MAX];
float MesPerSec;
unsigned int COUNT_ONE_CANAL;
@@ -195,10 +194,8 @@ interrupt void adc_isr(void)
cwnt_ok[i] = 0;
}
if(ADC_skip[++cownt_cans]) cownt_cans++;
if( cownt_cans >= TPL_CANS+2)
cownt_cans=0;
if(++cownt_cans>= TPL_CANS+2)
cownt_cans = 0;
}
fin:

View File

@@ -1,5 +1,4 @@
extern float ADC_table[];
extern int ADC_skip[];
extern float MesPerSec;
void setup_adc(void);

View File

@@ -43,8 +43,8 @@
//-----------------------------------------------
//-----------------------------------------------
#define TPL_INV 7
#define TPL_FLT 6
#define TPL_INV 8
#define TPL_FLT 8
#define TPL_ENG 8
#define TPL_MAX (TPL_INV + 2)

View File

@@ -79,14 +79,14 @@ void InitCan(int Port, int DevNum)
ECanRegs->CANMD.bit.MD0 = 0; // Ïåðåäà÷à
ECanMboxes->MBOX0.MSGID.all = 0;
ECanMboxes->MBOX0.MSGID.bit.IDE = 1; // extended id
ECanMboxes->MBOX0.MSGID.bit.STDMSGID = (CanDevAdr <<2 ) + (1<<10);
ECanMboxes->MBOX0.MSGID.bit.STDMSGID = ((0x80+CanDevAdr) <<2 ) + (1<<10);
// 1 àùèê
ECanRegs->CANMD.bit.MD1 = 1; // Ïðèåì
ECanMboxes->MBOX1.MSGID.all = 0;
ECanMboxes->MBOX1.MSGID.bit.IDE = 1;
ECanMboxes->MBOX1.MSGID.bit.AME = 1; // Ìàñêà
ECanMboxes->MBOX1.MSGID.bit.STDMSGID = (CanDevAdr << 2); // ó ïðèåìà ïðèîðèòåò âûøå
ECanMboxes->MBOX1.MSGID.bit.STDMSGID = ((0x80+CanDevAdr) << 2); // ó ïðèåìà ïðèîðèòåò âûøå
ECanaLAMRegs.LAM1.all = 0x000FFFFF;
// 2 àùèê
@@ -94,7 +94,7 @@ void InitCan(int Port, int DevNum)
ECanMboxes->MBOX2.MSGID.all = 0;
ECanMboxes->MBOX2.MSGID.bit.IDE = 1; // extended id
ECanMboxes->MBOX2.MSGID.bit.AME = 1; // Ìàñêà
ECanMboxes->MBOX2.MSGID.bit.STDMSGID = (0x1F << 2);
ECanMboxes->MBOX2.MSGID.bit.STDMSGID = (0x9F << 2);
ECanaLAMRegs.LAM2.all = 0x000FFFFF;
// âûáèðàåì òîëüêî 3 àùèêa äëà ðàáîòû, îñòàëüíûå çàïðåùàåì

View File

@@ -19,8 +19,6 @@ int TPL_CANS=0; //
int tpl_cans=0;
int cal_addr=0;
//int adcurr;
FLAG chk,sig;
int sens_type[SIZE];
@@ -30,7 +28,7 @@ float Kt[2];
FILTERBAT def_FILTERBAT = DEF_FILTERBAT;
FILTERBAT adc_filter[ADC_MAX];
float out_filter[DAT_MAX];
float out_filter[ADC_MAX];
unsigned int CanPowse=CANPOWSE,CanGO=0;
unsigned int Caliber_time=0;
@@ -145,8 +143,6 @@ void Init_sensors()
okay.bit.Ignor=1;
okay.bit.Imit=1;
for(i=0;i<TPL_MAX;i++) ADC_skip[i]=0;
for(i=0;i<SIZE;i++)
{
sens_type[i]=0;
@@ -164,14 +160,7 @@ void Init_sensors()
tpl_cans = TPL_CANS*2; cal_addr = tpl_cans; cans = TPL_CANS + 2;
for(i=0;i<tpl_cans;i++) sens_type[i] = TERMO_AD;
if(Mode==adr_FLT1 || Mode==adr_FLT2)
{
ADC_skip[1]=1;
sens_type[2]=0;
sens_type[3]=0;
cans--;
} }
}
if(Desk==dsk_BKSD)
{

View File

@@ -35,7 +35,7 @@ void Default_params()
modbus[i] = 0;
}
LastMode = 0x255; // ÷òîá âûçâàòü àâòîêàëèáðîâêó
LastMode = Mode;
Protokol = PROTOKOL;
if(Desk == dsk_PULT)
@@ -86,8 +86,8 @@ void Default_params()
for(i=0;i<start_data;i++)
if(sens_type[i] == TERMO_AD)
{
sens_hi_edge[i] = 70;
sens_lo_edge[i] = 60;
sens_hi_edge[i] = 80;
sens_lo_edge[i] = 70;
} }
if(Desk==dsk_BKSD)