03-07-2013 01:05 PM
need some help explaing this programme, from what i can see the frequency is being counted and the data acquisation card is used.the frequency is converted to seconds, then hours mins/sec etc for a clock display. struggling to understand dome of the " format to string" things etc. anyone help explain what the full operation is here? if not, no problem
Solved! Go to Solution.
03-07-2013 01:35 PM
I can understand what all the individual pieces do, but not what it's trying to achieve overall. Also the way it's doing it is terrible. It gets the current time and converts that to some amount of seconds (which can be done with just Get Date/Time in Seconds, no need for all the string conversions and math). Inside the loop, it reads an edge count from the DAQ, divides the count by 50, and adds the results to the number of seconds. Then it does all the seconds-conversion math in reverse to get individual hours, minutes and seconds (again, not needed, just add to the seconds obtained from Get Date/Time in Seconds). It formats those into a string of HH:MM:SS and writes to the string indicator. It also extracts each digit individually, and depending on the loop iteration number it writes one of those digits to a digital output.
The %02d:%02d:%02d formats three numbers into two-digit integer values separated by colons to get HH:MM:SS. The %1d%1d:%1d%1d:%1d%1d extracts the individual digits from HH:MM:SS (note that %1d occurs 6 times, in pairs of 2, separated by colons).
03-07-2013 04:13 PM
its for a synchronous clock, using the line frequency of the mains voltage, clock being a seven segent display, as in 6 of them