#include "DSP2833x_Device.h" // DSP281x Headerfile Include File #include "filter_bat2.h" #include "measure.h" #include "RS485.h" #include "message.h" #include "package.h" #include "peripher.h" #include "GPIO_table.h" int Mode,Desk,Addrr,TermoAD=0,TermoRS=0,TermoSW=0,Currentoz=0; LONGE Inputs; int ExtraCanal[24]; void get_Mode() { int i,qua; EALLOW; GpioCtrlRegs.GPAMUX1.all &= 0xFF000000; // 00—11 GpioCtrlRegs.GPAMUX2.all &= 0xFF00003F; // 19—27 GpioCtrlRegs.GPBMUX1.all &= 0xFFFFFCC0; // 32—34, 36 GpioCtrlRegs.GPBMUX2.all &= 0x000FF000; // 48—53, 58—63 GpioCtrlRegs.GPADIR.bit.GPIO20 = 0; GpioCtrlRegs.GPADIR.bit.GPIO21 = 0; GpioCtrlRegs.GPADIR.bit.GPIO22 = 0; GpioCtrlRegs.GPBDIR.bit.GPIO51 = 0; EDIS; Mode=0; qua=0; for(i=0;i<100;i++) qua += !GpioDataRegs.GPADAT.bit.GPIO22; if(qua>50) Mode += 1; qua=0; for(i=0;i<100;i++) qua += !GpioDataRegs.GPADAT.bit.GPIO20; if(qua>50) Mode += 2; qua=0; for(i=0;i<100;i++) qua += !GpioDataRegs.GPADAT.bit.GPIO21; if(qua>50) Mode += 4; Addrr = Mode*2; Mode+= 1; qua=0; for(i=0;i<100;i++) qua += !GpioDataRegs.GPBDAT.bit.GPIO51; if(qua>50) Addrr += 1; if( (Mode==adr_REC1)||(Mode==adr_REC2)) Currentoz = 1; if( (Mode==adr_REC1)||(Mode==adr_REC2)|| (Mode==adr_INV1)||(Mode==adr_INV2)) Desk = dsk_COMM; if (Mode==adr_SHKF) Desk = dsk_SHKF; if (Mode==adr_ISOL) Desk = dsk_ISOL; EALLOW; switch(Desk) { case dsk_COMM: GpioCtrlRegs.GPADIR.all = COMM_GPADIR; GpioCtrlRegs.GPBDIR.all = COMM_GPBDIR; break; case dsk_SHKF: GpioCtrlRegs.GPADIR.all = VEPP_GPADIR; GpioCtrlRegs.GPBDIR.all = VEPP_GPBDIR; break; case dsk_ISOL: GpioCtrlRegs.GPADIR.all = ISOL_GPADIR; GpioCtrlRegs.GPBDIR.all = ISOL_GPBDIR; break; } EDIS; } void get_Inputs() { static long butthurt[2] ={0,0}; unsigned long butt=0; if(Desk==dsk_COMM) { if(!GpioDataRegs.GPADAT.bit.GPIO7) butthurt[0]=0; else if(butthurt[0]