Doppia tastiera Wiegand
Home › Forum › Discussioni su problematiche generali › Doppia tastiera Wiegand
Taggato: wiegand tastiera rfid counter
- Questo topic ha 0 risposte, 1 partecipante ed è stato aggiornato l'ultima volta 9 ore, 51 minuti fa da
Emilio Pantanali.
Stai visualizzando 1 post (di 1 totali)
-
AutorePost
-
Ottobre 8, 2025 alle 12:06 pm #84189
Emilio Pantanali
PartecipanteBuongiorno, ho scritto un programma per gestire due tastiere su un unico mps056, una con ingressi su 0 ed 1, l’altra su ingressi 2 e 3
Anche dopo l’acquisto della chiave di protezione per lo sblocco del secondo counter mi da errore: User program error:9981201 e non vien vista la seconda tastiera
Questo è il programma che ho provato a scrivere// ***************************************************************************** // PROGRAM "ST_WiegandDcd_Double" // ***************************************************************************** // Gestisce due lettori Wiegand separati: // - Lettore 1 su ingressi 0 e 1 (DATA0/DATA1) // - Lettore 2 su ingressi 2 e 3 (DATA0/DATA1) // ***************************************************************************** IF (SysFirstLoop) THEN // Imposta frequenza di esecuzione del task eTO_JUNK(SysSetTaskLpTime(ID_TASK_FAST, 1000)); // --- Config lettore 1 --- CInp0[0].Address := 255; CInp0[0].Channel := 0; CInp0[0].Mode := 16#00000000; CInp0[1].Address := 255; CInp0[1].Channel := 1; CInp0[1].Mode := 16#00000001; // --- Config lettore 2 --- CInp0[2].Address := 255; CInp0[2].Channel := 2; CInp0[2].Mode := 16#00000000; CInp0[3].Address := 255; CInp0[3].Channel := 3; CInp0[3].Mode := 16#00000001; END_IF; // ============================================================================ // LETTORE 1 // ============================================================================ CInp0[0](); // Acquisizione contatore 0 CInp0[1](); // Acquisizione contatore 1 Data0[0] := TO_BOOL(CInp0[0].Value <> Value0[0]); Data0[1] := TO_BOOL(CInp0[1].Value <> Value0[1]); IF (Data0[0] OR Data0[1]) THEN Value0[0] := CInp0[0].Value; Value0[1] := CInp0[1].Value; TimeBf0 := SysTimeGetMs(); IF (Data0[0] AND Data0[1]) THEN Errors0 := Errors0 + 1; RETURN; END_IF; WDecoder0.WBCount := WDecoder0.WBCount + 1; WDecoder0.WBData := WDecoder0.WBData * 2; IF (Data0[1]) THEN WDecoder0.WBData := WDecoder0.WBData OR 16#00000001; END_IF; END_IF; // Decodifica dopo 100 ms senza bit IF ((SysTimeGetMs() - TimeBf0) > TO_UDINT(T#100ms)) THEN WDecoder0(Enable := TO_BOOL(WDecoder0.WBCount = 26)); IF (WDecoder0.CodeOk) THEN TAGID0 := TO_UDINT(WDecoder0.Facility) * 16#10000 + WDecoder0.IDNumber; END_IF; WDecoder0.WBCount := 0; WDecoder0.WBData := 0; END_IF; // ============================================================================ // LETTORE 2 // ============================================================================ CInp0[2](); // Acquisizione contatore 2 CInp0[3](); // Acquisizione contatore 3 Data1[0] := TO_BOOL(CInp0[2].Value <> Value1[0]); Data1[1] := TO_BOOL(CInp0[3].Value <> Value1[1]); IF (Data1[0] OR Data1[1]) THEN Value1[0] := CInp0[2].Value; Value1[1] := CInp0[3].Value; TimeBf1 := SysTimeGetMs(); IF (Data1[0] AND Data1[1]) THEN Errors1 := Errors1 + 1; RETURN; END_IF; WDecoder1.WBCount := WDecoder1.WBCount + 1; WDecoder1.WBData := WDecoder1.WBData * 2; IF (Data1[1]) THEN WDecoder1.WBData := WDecoder1.WBData OR 16#00000001; END_IF; END_IF; // Decodifica dopo 100 ms senza bit IF ((SysTimeGetMs() - TimeBf1) > TO_UDINT(T#100ms)) THEN WDecoder1(Enable := TO_BOOL(WDecoder1.WBCount = 26)); IF (WDecoder1.CodeOk) THEN TAGID1 := TO_UDINT(WDecoder1.Facility) * 16#10000 + WDecoder1.IDNumber; END_IF; WDecoder1.WBCount := 0; WDecoder1.WBData := 0; END_IF;
-
AutorePost
Stai visualizzando 1 post (di 1 totali)
- Devi essere connesso per rispondere a questo topic.