Ok SIM lettura byte BASE
This commit is contained in:
@@ -40,5 +40,48 @@ namespace IOB_WIN
|
||||
lg.Info("End init Adapter FANUC");
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void processAllMemory()
|
||||
{
|
||||
base.processAllMemory();
|
||||
|
||||
/*
|
||||
preparo lettura globale di
|
||||
- TUTTE le aree FANUC per segnali BITMAT
|
||||
- letture stato (feed, speed...)
|
||||
- letture accessorie (allarmi/eventi)
|
||||
*/
|
||||
|
||||
// per ora simulo
|
||||
simReadMem();
|
||||
|
||||
}
|
||||
|
||||
protected DateTime lastSim;
|
||||
protected int countSim = 0;
|
||||
private void simReadMem()
|
||||
{
|
||||
if (lastSim == null)
|
||||
{
|
||||
lastSim = DateTime.Now;
|
||||
}
|
||||
// se passato 1 sec genero NUOV num casuale e lo metto nel bit strobe... ogni 2 sec...
|
||||
if (DateTime.Now.Subtract(lastSim).TotalMilliseconds > 250)
|
||||
{
|
||||
countSim++;
|
||||
if (countSim > 255) countSim = 0;
|
||||
Strobes = BitConverter.GetBytes(countSim);
|
||||
lastSim = DateTime.Now;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void tryConnect()
|
||||
{
|
||||
base.tryConnect();
|
||||
|
||||
connectionOk = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user