Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- copyBuffer = new byte[375];
- Byte receivedValue = (Byte)port.ReadByte();
- //If receive 0xAA, start count how many 0xAA are
- if (receivedValue == 0xAA)
- {
- cnt++;
- if (cnt == 6)
- {
- port.Read(copyBuffer, 7, 368);
- for (int i = 7; i < 375; i++)
- Console.Write(copyBuffer[i] + ",");
- Console.WriteLine();
- copyBuffer[0] = 0x41;
- for (int i = 1; i <= 6; i++)
- copyBuffer[i] = 0xAA;
- totalprocessed++;
- sw.Stop();
- string result = sw.Elapsed.TotalSeconds.ToString();
- Console.WriteLine("Total : " + totalprocessed + " Time : " + result);
- copyBuffer = null;
- }
- }
- else
- {
- cnt = 0;
- }
- /*
- if (isOK)
- {
- DisplayArr(copyBuffer);
- isOK = false;
- }
- else
- {
- Console.WriteLine("Something Wrong");
- }*/
- hand_cnt++;
- if (hand_cnt == 100)
- hand_cnt = 0;
Advertisement
Add Comment
Please, Sign In to add comment