Ich habe ein Programm in C# geschrieben womit ich mit einem µC kommonizieren kenn. Ich schicke zuerst ein Kommando an den µC und warte dann in einer whileschleife auf antwort doch diese kommt nie. Nur die Fehlermeldung wie auf dem Bild. Zur Erläuterung des Programms: zuerst wird ein neuer Tread eröffnet
1 | DispensThread = new System.Threading.Thread(new ThreadStart(threadDispens)); |
2 | DispensThread.Start(); |
1 | private void threadDispens() |
2 | {
|
3 | try
|
4 | {
|
5 | serialPortal.Open(); |
6 | }
|
7 | catch
|
8 | {
|
9 | |
10 | }
|
11 | finally
|
12 | {
|
13 | Inhalt.InititDisp(serialPortal); |
14 | serialPortal.Close(); |
15 | }
|
16 | }
|
in Klasse von Inhalt
1 | public bool InititDisp(System.IO.Ports.SerialPort Port) |
2 | {
|
3 | Port.WriteLine("MG"); |
4 | while (!(PortEmpfangStatus)) |
5 | {
|
6 | }
|
Hat jemand Rat?