Hi all,
I have just written an Asyn driver for the Lambda TDK Genesys power supply, and I got it working after realising that before I can get it to do anything with comms I have to address it properly. This is RS232 comms, but for some reason
these PSUs seem to demand that the first command I send it when trying to interact with it is an “ADR” command with its RS485 address. I have managed to get it to work, by having one tiny db (let’s call it Init.db) file as follows:
record (ao, "$(P)ADDRESS"){
field(DTYP, "stream")
field(OUT, "@TDK_Lambda_Genesys.proto address $(PORT)")
field(VAL, "$(ADR)")
field(PINI, "YES")
}
This is then loaded with the subsection of the st.cmd along with the Main db file as follows:
dbLoadRecords("db/Init.db", "P=$(IOCNAME), PORT=L0, ADR=10")
dbLoadRecords("db/Main.db", "P=$(IOCNAME), PORT=L0")
This does seem to ensure that the address is set before any of the other records are actioned, with the few PINI Yes and Scan records connecting. However, this doesn’t seem quite right, I’m not even sure that it is meant to work the way
it seems to be. I did try having the record in my main db file, I think before any other interactions with the device, although not at the top of the file, and it didn’t seem to work. There is a chance I wasn’t where I thought in the file as this was being
tested on a production system, so was a little more hurried and I’m now trying to tidy the code up to be production ready, so the answer of put it at the top of the file might be the solution. A colleague suggested checking to see if PINI respected the PHAS
field, but I can’t find this information easily in the on line manuals, and I’m not sure I want to dissect the code to check this out, when someone here might have the answer available easily. The manuals tell me that linking records is a better option than
using PHAS, and that PINI is run before the normal scan tasks, which doesn’t exactly answer my question.
So, the simple version of the question:
Does PINI respect the PHAS field?
Alternatively:
Is there a tidier solution than my one above?
Regards,
Kathryn