If its not related to the PIC then why can't I ?
According to this http://www.microchip.com/stellent/id...cName=en532453
what does the 32 means if not supporting 32-bit ?
If its not related to the PIC then why can't I ?
According to this http://www.microchip.com/stellent/id...cName=en532453
what does the 32 means if not supporting 32-bit ?
I got a solution from a friend:
This will cover all cases for start: (Same will be for end but with End values)
HH>StartHH ||
HH=StartHH & MM>StartMM ||
HH=StartHH & MM=StartMM & SS>=StartSS
Should Start programs.
The only problem is wrap around at 23:59:00 -> 00:00:00
But this will be handled with a special flag to identify change from PM->AM
Last edited by menta; - 3rd July 2008 at 18:20.
Looks like that will work (with some parenthesis added).
This should work for the rest of it ...Added: You should keep in touch with your "Friend". It was a good "Tip".Code:TimeCmpFlags VAR BYTE PastStart VAR TimeCmpFlags.0 PastStop VAR TimeCmpFlags.1 NextDay VAR TimeCmpFlags.2 ProgON VAR TimeCmpFlags.3 CheckTimes: TimeCmpFlags = 0 ; clear flags first ; if the Start and Stop times are the same, then Always OFF if (Stop_H=Start_H) AND _ (Stop_M=Start_M) AND _ (Stop_S=Start_S) then AlwaysOFF ; is it past the Start time? if (Hours>Start_H) OR _ (Hours=Start_H AND Minutes>Start_M) OR _ (Hours=Start_H AND Minutes=Start_M AND Seconds>=Start_S) then PastStart=1 ; is it past the Stop time? if (Hours>Stop_H) OR _ (Hours=Stop_H AND Minutes>Stop_M) OR _ (Hours=Stop_H AND Minutes=Stop_M AND Seconds>=Stop_S) then PastStop=1 ; does the period end the following day? if (Stop_H< Start_H) OR _ (Stop_H=Start_H AND Stop_M < Start_M) OR _ (Stop_H=Start_H AND Stop_M=Start_M AND Stop_S < Start_S) then NextDay=1 ;--------------- if !NextDay then ; same day, use AND if PastStart AND !PastStop then ProgON = 1 else ; next day, use OR IF PastStart OR !PastStop then ProgON = 1 endif AlwaysOFF: return
Last edited by Darrel Taylor; - 4th July 2008 at 02:57. Reason: Added:
DT
Thanks,
But, there is still a problem when there are 2 programs with a gap between each other.
Second one will always try to make it off as the current time is not in its range, while the first one is on
yeah,
The device can have several programs
e.g
Start 13:00:00 End 13:30:00
Start 14:00:00 End 14:30:00
Start 17:00:00 End 17:30:00
You need to start telling us those things at the beginning.
If you change all the Start/Stop/Flag variables to arrays, it should work with multiple programs.
.
DT
With any luck, this should clear it up a bit...
PBP is a COMPILER....MPASM is an ASSEMBLER.
PBP supports...PICxxxxx (see their website...way too many to list)
MPASM supports...well, basically, anything in the Microchip inventory.
The PIC32 is supported by MPASM, the assembler.
The PIC32 isn't supported by PicBasicPro, the compiler.
A program is written (source code), is compiled (by PBP) into assembly code (machine code), and assembled (by MPASM) into hex code (binary to be programmed) by the programmer (PICKIT2 for example).
once started or stopped, start looking for the next event starting with hour = then min = then second > as DT suggested earlier if then.....
same logic a human would use looking for an event
amgen
Bookmarks