Completata gestione lettura banco memoria x testing x OSAI
This commit is contained in:
@@ -282,7 +282,7 @@ namespace MTC_Adapter
|
||||
int memIndexA = 19018;
|
||||
int memIndexB = 19698;
|
||||
|
||||
// LEGGO SEMPRE a WORD 16bit (+ veloce...)
|
||||
// NB: LEGGO SEMPRE a WORD 16bit (+ veloce...)
|
||||
|
||||
// leggo blocco dati + grande...
|
||||
inizio = DateTime.Now;
|
||||
@@ -345,7 +345,9 @@ namespace MTC_Adapter
|
||||
}
|
||||
|
||||
// verifico strobe dell'auto-test
|
||||
processTestStrobe();
|
||||
currStrobe = (StFlag8)(Strobes[7]); // 8° byte
|
||||
currAck = (StFlag8)(Acknowl[7]); // 8° byte
|
||||
processTestStrobe(currStrobe, currAck, 19021, 1);
|
||||
|
||||
// gestione bit di watchdog... sulal DWord successiva
|
||||
sendWatchDog();
|
||||
@@ -364,10 +366,6 @@ namespace MTC_Adapter
|
||||
{
|
||||
// byte di strobe e di acknowledge... inizializzo!!!
|
||||
byte[] currACK_DW = new byte[1];
|
||||
// inizializzo vettori ulteriori (userAction, testing data, unkStrobes...)
|
||||
#if false
|
||||
string UnkStrobe = "";
|
||||
#endif
|
||||
// altre variabili
|
||||
int bitNum = 0;
|
||||
inizio = DateTime.Now;
|
||||
@@ -437,27 +435,11 @@ namespace MTC_Adapter
|
||||
bitNum = 6;
|
||||
gestStrobeUserAction(bitNum, ref currACK_DW, ref UserAction, string.Format(" (P{0:00} RESET) ", idxPath));
|
||||
|
||||
//2017.03.27 tolto controllo ALTRI stobes
|
||||
#if false
|
||||
// processo tutti gli strobe x i BIT 7 NON gestiti in modo da dare comunque ACK e event...
|
||||
for (int i = 7; i < 8; i++)
|
||||
{
|
||||
gestStrobeUserAction(i, ref currACK_DW, ref UnkStrobe, string.Format(" [STROBE_{0:00}] ", i));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if false
|
||||
// se mi sono rimasti degli strobe di lettura allarmi alzati li abbasso
|
||||
if (ACK_DW1 != StFlag32.NONE)
|
||||
{
|
||||
#endif
|
||||
// inizializzo 4 byte a zero!!!
|
||||
currACK_DW = new byte[1];
|
||||
#if false
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -465,16 +447,6 @@ namespace MTC_Adapter
|
||||
lg.Info("Errore in strobe");
|
||||
}
|
||||
|
||||
|
||||
// 2017.03.27 tolti UNK strobes
|
||||
#if false
|
||||
// Invio comunque strobe non riconosciuti
|
||||
if (mUnkStrobe.Value.ToString() != UnkStrobe.Trim())
|
||||
{
|
||||
mUnkStrobe.Value = UnkStrobe.Trim();
|
||||
}
|
||||
#endif
|
||||
|
||||
// scrivo update ad ack SE VARIATO!!!
|
||||
if (currAck != (StFlag8)currACK_DW[0])
|
||||
{
|
||||
@@ -486,14 +458,17 @@ namespace MTC_Adapter
|
||||
/// <summary>
|
||||
/// Verifica strobe autotest
|
||||
/// </summary>
|
||||
private void processTestStrobe()
|
||||
/// <param name="currStrobe"></param>
|
||||
/// <param name="currAck"></param>
|
||||
/// <param name="memIndexAck"></param>
|
||||
private void processTestStrobe(StFlag8 currStrobe, StFlag8 currAck, int memIndexAck, int memOrderStart)
|
||||
{
|
||||
// byte di strobe e di acknowledge... inizializzo!!!
|
||||
byte[] currACK_DW = new byte[1];
|
||||
string TestingData = "";
|
||||
#if false
|
||||
// AREA strobe x TEST
|
||||
// INIZIO TEST...
|
||||
bitNum = 30;
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
int bitNum = 6;
|
||||
if (currStrobe.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
// formatto stringa risultato
|
||||
TestingData = string.Format("START TEST{0}", getTestData(utils.CRS("testCharSep")));
|
||||
@@ -502,7 +477,7 @@ namespace MTC_Adapter
|
||||
currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
|
||||
}
|
||||
// FINE TEST...
|
||||
bitNum = 31;
|
||||
bitNum = 7;
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
// formatto stringa risultato
|
||||
@@ -510,12 +485,21 @@ namespace MTC_Adapter
|
||||
|
||||
// memorizzo allarme nel vettore ack....
|
||||
currACK_DW = utils.setBitOnStFlag(currACK_DW, true, bitNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// INVIO COMUNQUE stato test...
|
||||
mTestingData.Value = TestingData.Trim();
|
||||
#endif
|
||||
// INVIO stato test...
|
||||
if (mTestingData.Value.ToString() != TestingData.Trim())
|
||||
{
|
||||
mTestingData.Value = TestingData.Trim();
|
||||
}
|
||||
|
||||
// scrivo update ad ack SE VARIATO!!!
|
||||
if (currAck != (StFlag8)currACK_DW[0])
|
||||
{
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(W, OSAI.MemTypeWord.MW_CODE, memIndexAck, memOrderStart, ref currACK_DW);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}-B", currACK_DW.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia (se necessario) il watchdog di stato in vita... blink 0/1 ogni secondo
|
||||
@@ -547,9 +531,8 @@ namespace MTC_Adapter
|
||||
private string getTestData(string charSep)
|
||||
{
|
||||
string answ = "";
|
||||
#if false
|
||||
// Area di memoria x test... 64 byte
|
||||
byte[] MemBlockTestData = new byte[64];
|
||||
// Area di memoria x test... (64 DWord) (la prima va splittata)
|
||||
UInt32[] MemBlockTestData = new UInt32[64];
|
||||
// variabili numero test e num parametri impiegati
|
||||
int testNum = 0;
|
||||
int numPar = 0;
|
||||
@@ -557,14 +540,14 @@ namespace MTC_Adapter
|
||||
UInt32 testParam = 0;
|
||||
|
||||
// leggo tutto!!!
|
||||
int memIndex = 11000;
|
||||
int memIndex = 19700;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.R, memIndex, ref MemBlockTestData);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA_DW1", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref MemBlockTestData);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TEST_DATA", MemBlockTestData.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
// recupero cod univoco test e numero parametri impiegati
|
||||
testNum = BitConverter.ToUInt16(MemBlockTestData, 0);
|
||||
numPar = BitConverter.ToUInt16(MemBlockTestData, 2);
|
||||
testNum = BitConverter.ToUInt16(BitConverter.GetBytes(MemBlockTestData[0]), 0);
|
||||
numPar = BitConverter.ToUInt16(BitConverter.GetBytes(MemBlockTestData[0]), 2);
|
||||
|
||||
|
||||
// riporto separatore + numero test + num parametri
|
||||
@@ -574,12 +557,11 @@ namespace MTC_Adapter
|
||||
{
|
||||
for (int i = 0; i < numPar; i++)
|
||||
{
|
||||
testParam = BitConverter.ToUInt32(MemBlockTestData, 4 * (1 + i));
|
||||
testParam = MemBlockTestData[1 + i];
|
||||
answ += string.Format("{0}{1}", charSep, testParam);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -1590,7 +1572,7 @@ namespace MTC_Adapter
|
||||
{
|
||||
base.processAlarm();
|
||||
|
||||
// ggiungo gestione allarmi CNC
|
||||
// aggiungo gestione allarmi CNC
|
||||
checkCNCAlarms();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user