Hi guys,

it's late and my tiny pair of brain cells have stopped working !

I use a set of array variables to set up hours and minutes and then convert them into a word variable which is then used to match other word variables to activate pins on the pic.

Code:
CH1_on_Time = (lightsetHR1*60)+lightsetMN1
So the word variable CH1_on_time is the result of multiplying the lightsetHR1 variable (which would be anything from 00 to 23) by 60 to get the minutes, and then add on the value of lightsetMN1 (which will be anything from 00 to 59) which then gives the total minutes since 00:00 hrs which is thus stored in CH1_on_Time. I then convert the current time from a DS1307 into minutes since midnight and store the result in another word variable and use simple IF / THEN statements to do functions when the two variables match. It's crude I know, but it works and is less prone to errors when matching Hrs and Mins directly.

However I now have a need to reverse the above function and convert the value stored in the CH1_on_time so that I get the value for lightsetHR1 and lightsetMN1.

For example setting the on time to 14:30 the value for CH1_on_time = 870 (14*60 = 840 + 30). I want to take the 870 and convert it back so the value for lightsetHR1 = 14 and lightsetMN1 = 30. Using simple division, ie 870 / 60, but this fails as it =14.5 and PBP doesn't support FP and I would then have to somehow 0.5 hrs in to minutes by multiplying by 60. Is there a way of using a remainder function. So that so that it takes the 870 / 60 takes the integer value of 14 and placed that in lightsetHR1, multiplies that integer by 60 to get 840, then takes the 840 away from 870 to get the remainder of 30 and placed that in the lightsetMN1 variable ?