void PumpStartStop(void)
{
pdata = PmpLoadBuffer[2];
cc = 0;
nCount = 5;
I2C1_MESSAGE_STATUS status;
PmpTimer = (pmptmr.pumptimer0)|(pmptmr.pumptimer1<<1)|(pmptmr.pumptimer2<<2)
|(pmptmr.pumptimer3<<3)|(pmptmr.pumptimer4<<4)|(pmptmr.pumptimer5<<5)
|(pmptmr.pumptimer6<<6)|(pmptmr.pumptimer7<<7);
PmpTimerOn = (pmptmon.pmpon0)|(pmptmon.pmpon1<<1)|(pmptmon.pmpon2<<2)|
(pmptmon.pmpon3<<3)|(pmptmon.pmpon4<<4)|(pmptmon.pmpon5<<5)|
(pmptmon.pmpon6<<6)|(pmptmon.pmpon7<<7);
//bit shift to the left "bb" times
timer = 0x01<<bb;
/*Masking the bits to see if the timer is in use then*/
/*masking again to determine which timer to set the RTC RAM address*/
if (PmpTimer & timer ? On : Off)
{
TimerUse = (PmpTimer & timer);
switch (TimerUse)
{
case 0x01:
{
PmpLoadBuffer[0] = PumpTime0;
break;
}
case 0x02:
{
PmpLoadBuffer[0] = PumpTime1;
break;
}
case 0x04:
{
PmpLoadBuffer[0] = PumpTime2;
break;
}
case 0x08:
{
PmpLoadBuffer[0] = PumpTime3;
break;
}
case 0x10:
{
PmpLoadBuffer[0] = PumpTime4;
break;
}
case 0x20:
{
PmpLoadBuffer[0] = PumpTime5;
break;
}
case 0x40:
{
PmpLoadBuffer[0] = PumpTime6;
break;
}
case 0x80:
{
PmpLoadBuffer[0] = PumpTime7;
break;
}
default:
break;
}/*switch*/
for (counter = 0; counter < nCount; counter++)
{
while(status != I2C1_MESSAGE_FAIL)
{
I2C1_MasterRead(*pdata,1,RTCC,status);
//wait for message to be sent
while(status == I2C1_MESSAGE_PENDING);
if (status == I2C1_MESSAGE_COMPLETE)break;
}
PmpLoadBuffer[1]= PumpRun[cc];
cc++;
}
bb++;
}
else bb=0;
}