DEVELOPMENT PROCESS
As the application is designed to be as simple as possible, the first thing to start with is a simple code which uses buttons for connecting to the board (“Connect”) and disconnecting from it (“Disconnect”).
For displaying the information received from the board, a RichEdit is placed into the application. The source code should have functions for opening ports, closing them, reading from and writing to the buffer as well as error handling.
Code Snippet
As the application is designed to be as simple as possible, the first thing to start with is a simple code which uses buttons for connecting to the board (“Connect”) and disconnecting from it (“Disconnect”).
For displaying the information received from the board, a RichEdit is placed into the application. The source code should have functions for opening ports, closing them, reading from and writing to the buffer as well as error handling.
Code Snippet
//-----Code Snippet from the TCommPort Constructor-----//The first step of implementing the communication library into the application is to assign the “OpenCommPort()” function to the “Connect” Button.
TCommPort::TCommPort()
: m_CommOpen(false),
m_CommPort(“COM5”),
m_hCom(0)
{
m_dcb.DCBlength = sizeof(DCB);
m_dcb.BaudRate =1382400;
m_dcb.ByteSize =8;
m_dcb.Parity =NOPARITY; //NOPARITY and friends are #defined in windows.h
m_dcb.StopBits =ONESTOPBIT; //ONESTOPBIT is also from windows.h
}
//----end of TCommPort constructor-----//