Aggiunta metodo x lettura parametri IOB-WIN x FANUC (counters)
This commit is contained in:
@@ -856,7 +856,87 @@ namespace IOB_WIN
|
||||
private string getValByParam(string varName)
|
||||
{
|
||||
string answ = "";
|
||||
// verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
|
||||
string memAddr = cIobConf.optPar[varName];
|
||||
if (memAddr.StartsWith("STD"))
|
||||
{
|
||||
// inizio verifica area memoria/parametro levando prima parte codice
|
||||
memAddr = memAddr.Replace("STD.", "");
|
||||
// var di appoggio
|
||||
int cntAddr = 0;
|
||||
object outputVal = new object();
|
||||
// verifico se si tratta di lettura parametro... formato tipo STD.PAR.6711
|
||||
if (memAddr.StartsWith("PAR."))
|
||||
{
|
||||
// recupero parametro...
|
||||
int.TryParse(memAddr.Replace("PAR.", ""), out cntAddr);
|
||||
// processo parametro
|
||||
stopwatch.Restart();
|
||||
FANUC_ref.F_RW_Param_Integer(false, cntAddr, 3, ref outputVal);
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-PAR", 4), stopwatch.ElapsedTicks);
|
||||
}
|
||||
// salvo valore
|
||||
answ = outputVal.ToString();
|
||||
}
|
||||
// altrimenti se legge da area memoria specifica leggo da li... formto tipo STD.D.1604.DW
|
||||
else
|
||||
{
|
||||
memAddressFanuc areaCounter = new memAddressFanuc(memAddr);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lgInfo("[0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType);
|
||||
}
|
||||
|
||||
// leggo!
|
||||
stopwatch.Restart();
|
||||
// switch x tipo dati --> tipo lettura... e salvo ultimo conteggio rilevato
|
||||
switch (areaCounter.vType)
|
||||
{
|
||||
case "B":
|
||||
byte valB = 0;
|
||||
FANUC_ref.F_RW_Byte(false, areaCounter.mType, areaCounter.mPos, ref valB);
|
||||
outputVal = valB;
|
||||
break;
|
||||
case "D":
|
||||
ushort valW = 0;
|
||||
FANUC_ref.F_RW_Word(false, areaCounter.mType, areaCounter.mPos, ref valW);
|
||||
outputVal = valW;
|
||||
break;
|
||||
case "DW":
|
||||
uint valDW = 0;
|
||||
FANUC_ref.F_RW_DWord(false, areaCounter.mType, areaCounter.mPos, ref valDW);
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lgInfo("[1] valDW PAR: {0}", valDW);
|
||||
}
|
||||
|
||||
outputVal = valDW;
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lgInfo("[2] outputVal PAR: {0}", outputVal);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(cIobConf.codIOB, string.Format("R-{0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType), stopwatch.ElapsedTicks);
|
||||
}
|
||||
|
||||
// salvo...
|
||||
answ = outputVal.ToString();
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lgInfo("[3] PAR letto: {0} | {1}", varName, answ);
|
||||
}
|
||||
}
|
||||
stopwatch.Stop();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user