102 lines
2.0 KiB
C
102 lines
2.0 KiB
C
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
|
#include "DSP2833x_SWPrioritizedIsrLevels.h"
|
|
|
|
#include "RS485.h"
|
|
#include "message.h"
|
|
#include "filter_bat2.h"
|
|
#include "measure.h"
|
|
#include "package.h"
|
|
#include "pulto.h"
|
|
#include "kanal.h"
|
|
#include "tools.h"
|
|
#include "peripher.h"
|
|
|
|
unsigned long isMask;
|
|
int isNumb;
|
|
|
|
int quaLamp = 7;
|
|
|
|
unsigned long LoneLeft=0,LoneRite=0;
|
|
|
|
void what_is()
|
|
{
|
|
static unsigned int count_blink;
|
|
static int numb=0;
|
|
|
|
if(++count_blink >= BLINK_TIME)
|
|
{
|
|
count_blink=0;
|
|
|
|
numb++; if(numb==10) numb=0;
|
|
isNumb = numb*1000 + numb*100 + numb*10 +numb;
|
|
|
|
if(isMask) isMask = 0;
|
|
else isMask = 0xFFFFFFFF;
|
|
} }
|
|
|
|
interrupt void cpu_timer1_isr_PULT(void)
|
|
{
|
|
static unsigned int cownt=0,count_bright;
|
|
unsigned int light=0, i;
|
|
unsigned long Alone = 20 * READY_FREQ;
|
|
int loneL=1,loneR=1;
|
|
|
|
EALLOW;
|
|
CpuTimer1.InterruptCount++;
|
|
IER |= MINT13; // Set "global" priority
|
|
EINT;
|
|
EDIS; // This is needed to disable write to EALLOW protected registers
|
|
|
|
if(!cReset)
|
|
ServiceDog();
|
|
|
|
if(++CanPowse >= CANPOWSE)
|
|
{
|
|
CanPowse = 0;
|
|
CanGO = 1;
|
|
}
|
|
|
|
toggle_ONLINE();
|
|
|
|
if(++LoneLeft > Alone)
|
|
{
|
|
LoneLeft = Alone;
|
|
loneL = 0;
|
|
}
|
|
if(++LoneRite > Alone)
|
|
{
|
|
LoneRite = Alone;
|
|
loneR = 0;
|
|
}
|
|
|
|
if(++count_bright >= maximum_bright) count_bright = 0 ;
|
|
|
|
for(i=0; i<quaLamp; i++)
|
|
{
|
|
if(count_bright < Bright[i]) light+=(1<<i);
|
|
}
|
|
|
|
if(++cownt>2) cownt=0;
|
|
|
|
modbus[0] = max(modbus[4]*loneL, modbus[10]*loneR);
|
|
modbus[1] = max(modbus[5]*loneL, modbus[11]*loneR);
|
|
modbus[2] = modbus[6]*loneL | modbus[12]*loneR;
|
|
modbus[3] = modbus[7]*loneL | modbus[13]*loneR;
|
|
|
|
if(cTestLamp|bTestLamp)
|
|
{
|
|
what_is();
|
|
|
|
if(cownt == 0) kanal_Send(0,isNumb,4);
|
|
if(cownt == 1) kanal_Send(1,isNumb,4);
|
|
kanal_Send(2,isMask,0);
|
|
if(cownt == 2) kanal_Send(3,isMask,0);
|
|
}
|
|
else
|
|
{
|
|
if(cownt == 0) kanal_Send(0,modbus[0],0);
|
|
if(cownt == 1) kanal_Send(1,modbus[1],0);
|
|
kanal_Send(2,modbus[2] & light,0);
|
|
if(cownt == 2) kanal_Send(3,modbus[3],0);
|
|
} }
|