I am writing a code that will output a set of bit array through the com port and too hyperterminal on another computer. I need to have this transfer till i press stop button on my GUI interface. I know we need to use threading to do this task. The code below outputs the bits to hyperterminal once. I would like to know how to make it a constant loop till i press stop. Suggestions would be wonderful.
public void TransmitData()
byte bytearray = new byte;
SerialPort port = new SerialPort("COM2", 9600, Parity.None, 8, StopBits.One);
for (int i = 0; i < 512; i++)
bytearray[i] = (byte)array[i];
port.Write(bytearray, 0, 512);
MessageBox.Show("Please Connect Serial Cable");