From: "Silver"<[email protected]>
To: "tech-talk"<[email protected]>
Sent: Wednesday, May 15, 2013 8:47:10 AM
Subject: How to output arrary data in EPICS db?
hi, :
I am using simens plc driver by dirk and want to write array data to
plc. The array is read from a data file on disk. So I use sub record
or gensub to get array. The db file is as following:
record(genSub,"$(id):gensub")
{
field(SCAN, "Passive")
field(INAM, "genSubArrayInit")
field(SNAM, "genSubArrayOut")
field(OUTA, "$(id):waveform.VAL")
field(FTVA, "SHORT")
field(NOVA, "12")
}
record(waveform,"$(id):waveform")
{
field(FTVA, "SHORT")
field(NELM, "12")
}
The vala field of genSub record is a pointer to arrary data, I set it
to waveform record’s val field. then use caget can get the array.
But waveform is an input record, so I want to use aao record to
implement the function. Kindly, dirk added aao support to the s7-plc
driver. If use "caput –a xx xxx xxx", the aao record can write the
array to hardware.
So I change the db file like this:
record(genSub,"$(id):gensub")
{
field(SCAN, "Passive")
field(INAM, "genSubArrayInit")
field(SNAM, "genSubArrayOut")
field(OUTA, "$(id):aao.VAL")
field(FTVA, "SHORT")
field(NOVA, "12")
# field(FLNK,"$(id):aao")
}
record(waveform,"$(id):waveform")
{
field(SCAN, "I/O Intr")
field(DTYP,"S7plc")
field(OUT,"@Siemens_S7: 0/200 'T=SHORT'")
field(FTVA, "SHORT")
field(NELM, "12")
}
But the IOC corrupted by Segement Default error. Seems there is a
pointer error somewhere. I also tried to write a small code by using
ezca library to write the array to aao record directly, it failed
too. But the same code of ezcaPut can write array to waveform
record.
So, what’s the difference between waveform and aao in this case? Can
anyone help me?
Ps, I searched the tech-talk, Andy Foster said he has written a
waveform out record long long ago, but the download url is invalid.
--------------
Best wishes
Geyang 2013-05-15