/Pulses on inputs 1 to 4 are counted.
/When the count reaches 10 the corresponding output is turned on
/Input 8 is used to reset all the counts

Variables
u8 IPCounter[4]
u8 IP1Status
u8 IP2Status
u8 IP3Status
u8 IP4Status
u8 Count
End

Start
if Input1=1
   if IP1Status=0
       IPCounter[0]=1+IPCounter[0]
       IP1Status=1
   endif
else
   IP1Status=0
endif
if IPCounter[0]>10
   Output1=1
   else
   Output1=0
endif

if Input2=1
   if IP2Status=0
   IPCounter[1]=1+IPCounter[1]
   IP2Status=1
   endif
else
   IP2Status=0
endif
if IPCounter[1]>10
   Output2=1
else
   Output2=0
endif

if Input3=1
   if IP3Status=0
       IPCounter[2]=1+IPCounter[2]
       IP3Status=1
   endif
else
   IP3Status=0
endif
if IPCounter[2]>10
   Output3=1
else
   Output3=0
endif

if Input4=1
   if IP4Status=0
         IPCounter[3]=1+IPCounter[3]
         IP4Status=1
   endif
else
   IP4Status=0
endif
if IPCounter[3]>10
   Output4=1
else
   Output4=0
endif

if Input8=1
   Count=0
   for 4
       IPCounter[Count]=0
       Count=Count+1
     endfor

endif

End




 

 

 

Example 7