shitallj
asked on
reading electronic balance
Hi,
I want to read weigh from electronic balance (connected through com port 1 or 2) and display it in edit box on dialog. How can I do it? Any sample code or useful link please.
I want to read weigh from electronic balance (connected through com port 1 or 2) and display it in edit box on dialog. How can I do it? Any sample code or useful link please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have done it like this.
I have attached a CString member variable to the CEdit control
by going to Class Wizard and selecting the member variables tab
unsigned char * rx_buffer = new unsigned char[number_of_chars+1];
Port.Read(number_of_chars+ 1,rx_buffe r); //read the port
buffer[0]=__toascii(rx_buf fer[0]);
m_kelvin_temp = buffer[0];
for(n=1;n<8;n++)
{
buffer[n]=__toascii(rx_buf fer[n]);
m_kelvin_temp +=buffer[n];
}
I have attached a CString member variable to the CEdit control
by going to Class Wizard and selecting the member variables tab
unsigned char * rx_buffer = new unsigned char[number_of_chars+1];
Port.Read(number_of_chars+
buffer[0]=__toascii(rx_buf
m_kelvin_temp = buffer[0];
for(n=1;n<8;n++)
{
buffer[n]=__toascii(rx_buf
m_kelvin_temp +=buffer[n];
}
shitallj, sre you still with us?
I'd say the Q is answered.
If so, you just open the COM port using CreatFile(), read the data with ReadFile(), and write with WriteFile().