Experimental Physics and
| |||||||||||||||||
|
Kay-Uwe Kasemir wrote: ... Has anybody done something like this? PVs for configuring the time, plus sequencer code for determining the next runtime etc.? We have a 'console chime' subroutine record that we run on all our vxWorks IOCs here; it prints out the time on the IOC console at a selected interval but could be used as the basis of what you're after. The default is to chime hourly on the hour, but it can be set to any minute period by changing the value in A - set it to 15 and you'll get chimes at 15, 30 and 45 minutes past the hour (not just at 15 minute intervals after the IOC started up - it's cleverer than that). For your purposes you'd want to replace the 'printf' with a call to post_event(psub->b) and you will get the soft event number in B posted at the minute interval in A. The subroutines used are: /* consoleChime.c,v 1.1.2.1 2004/12/23 16:53:44 anj Exp */ /* consoleChime field usage: * * A = chime period in minutes, defaults to 60 if not set * L = timestamp (secPastEpoc) when we last chimed */ #include <stdio.h> #include <sysLib.h> #include <shellLib.h> #include "tsDefs.h" #include "subRecord.h" static char prompt[20]; long consoleChimeInit(subRecord *psub) { TS_STAMP now; if (psub->a < 1.0) psub->a = 60.0; /* Default to chiming hourly */ tsLocalTime(&now); psub->l = now.secPastEpoch; sprintf(prompt, "%.13s> ", sysBootParams.targetName); shellPromptSet(prompt); return 0; } long consoleChime(subRecord *psub) { epicsUInt32 period, next; TS_STAMP now; if (psub->a < 1.0) psub->a = 1.0; /* Chime at most once a minute */ period = 60 * (epicsUInt32) psub->a; next = period * (1 + (epicsUInt32) psub->l / period); tsLocalTime(&now); if (now.secPastEpoch >= next) { /* Bong bong bong bong */ TS_DETAIL chime; tsStampToLocal(now, &chime); printf("\n%4.4d-%2.2d-%2.2d %2.2d:%2.2d %s", chime.year, chime.monthNum+1, chime.dayMonth+1, chime.hours, chime.minutes, prompt); psub->l = now.secPastEpoch; } return 0; } The record looks like this: record(sub, "$(IOC):consoleChime") { field(DESC, "Print time on IOC console") field(INAM, "consoleChimeInit") field(SNAM, "consoleChime") field(SCAN, "10 second") field(PRIO, "LOW") } For those curious, the console chime allows us to see when any error messages that appear on an IOC's console actually occurred, since it may be days or even longer between someone looking at the IOC console and many errors don't get sent to the error logger. If course if it's weeks you would probably want to set the chime period to something like 1440=24 hours unless you have a *really* long history buffer on your screens sessions. - Andrew -- There is considerable overlap between the intelligence of the smartest bears and the dumbest tourists -- Yosemite National Park Ranger
| ||||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |