RFID TagPresent use in object exception

Dear Colleagues,

We are working here on an object for our ToolControl system, and we use also RFID for it.

First we started to use the DataTagAccess object, and we parametrised inside with the interface.

Since then we learned the we don't need the read command, so we only use the fix code from the BIS V-6110 peripheral.

During startup my object's ParCfg is parametrised with the interface.

I can use  the fixcode in my project with the following line:

_manageUidToString(_parcfg.iDataTagStream.Uid,_uidInString=>OutImm.BoxHead.UniqueId);

(Where we just convert array of bytes to string.)

Problem comes when I would like to check TagPresent:

_tagPresR( CLK := _parCfg.iDataTagStream.TagPresent );

I got an exception immediately when I would like to use it any way. (Tried with direct use also, without rising edge)

If I use directly the peripheral (Peripherals._A204HeadChannel.TagPresent) then it is working, but I had one idea what I don't like to use it in the object, to put it into the OnApplyPar immediately, and hand it over to a local bool.

Do You have any idea to use the _parCfg.iDataTagStream.TagPresent inside my code somehow?

 

Best reply by Thorsten_Brach

At what exact moment do you access the interface ?

Is it possible that the interface is not yet set but is already being accessed ?

Try to check the interface is set, before accessing it :

IF ( _parCfg.iDataTagStream <> XNULL )
THEN
_tagPresR( CLK := _parCfg.iDataTagStream.TagPresent );
END_IF

But as Düscha explained, you normaly should not access the _parCfg parameters from outside the function block,
where the _parCfg is declared...




View original
5 replies
Resolved