All,
I am writing EPICS records for a digital pattern generator. The DPG works by providing it with a CSV file containing raw pattern bits. This process has three states: LOADING (1), LOAD COMPLETE (2), LOAD ERROR (3).
What I have done is create several records shown below. ‘select_read_status’ is the record containing one of the three states.
record(aSub, "upload_pattern")
{
field(DESC, "Get the pattern filepath")
field(SCAN, "Passive")
field(SNAM, "p_file_upload")
field(INPA, "get_pattern_filepath")
field(INPB, "set_user_pattern")
field(FTA, "STRING")
field(FTB, "STRING")
field(OUTA, "set_pattern")
field(FTVA, "CHAR")
field(NOVA, 1970000)
field(OUTB, "select_read_status.SELN")
field(FTVB, "DOUBLE")
field(FLNK, "set_pattern")
}
record(waveform, "set_pattern")
{
field(DTYP, "stream")
field(DESC, "Set GFT7048's pattern")
field(FTVL, "CHAR")
field(NELM, 1970000)
field(INP, "@GFT7048.proto setPattern $(PORT)")
}
record(ao, "load")
{
field(DESC, "Load button")
field(SCAN, "Passive")
field(VAL, "0")
field(FLNK, "srs_load")
}
record(seq, "srs_load")
{
field(DESC, "Set the index for status")
field(SCAN, "Passive")
field(DOL1, "1")
field(LNK1, "select_read_status.SELN")
field(FLNK, "split")
}
record(fanout, "split")
{
field(DESC, "What")
field(SCAN, "Passive")
field(LNK0, "select_read_status")
field(LNK1, "upload_pattern")
}
record(sel, "select_read_status")
{
field(DESC, "Choose which mess. to show")
field(SCAN, ".1 second")
field(SELM, 0)
field(INPA, 0) # PAUSE
field(INPB, 1) # LOADING
field(INPC, 2) # ERROR
field(INPD, 3) # COMPLETED
}
When the ‘load’ record is processed, it proceeds to set the ‘srs_load’ record, which will set the ‘select_read_status.SELN’ to be 1. This is followed by a fanout record named ‘split’, which will first process the ‘select_read_status’. If
my understanding is correct, this will proceed to set ‘select_read_status.VAL’ to be whatever constant link is provided in the INPB field. Then, ‘split’ processes ‘set_pattern’ asub record, which contains an output link that is set to ‘select_read_status.SELN’.
If the sub-routine used by ‘set_pattern’ successfully loaded the pattern, a 2 is returned. Otherwise, a 3 is returned.
The good news is that ‘select_read_status’ can be set to be 2 or 3, when I process ‘load’. However, ‘select_read_status.SELN’ doesn’t seem to be set to 1 until like a few milliseconds before it is set by ‘set_pattern’. For example, if I
ran ‘camonitor select_read_status.SELN’, it would show 1, but then 2 or 3 immediately after. This defeats the purpose of telling the end user what is the status of the program.
The whole reason why I am creating ‘select_read_status’ is for a multi-color indicator on a CSS GUI. If it is 1, it turns yellow to signify loading. If it is 2, it turns green to signify the pattern was set successfully, and so on.
Is there some way to create a delay so that ‘select_read_status’ is set to be 1 before running ‘set_pattern’?
Andy