Link to home
Start Free TrialLog in
Avatar of shitallj
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.
Avatar of jhance
jhance

Do you have information from the makers of the balance as to what gets sent or received via the serial (i.e. COM) port?

If so, you just open the COM port using CreatFile(), read the data with ReadFile(), and write with WriteFile().

ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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_buffer);  //read the port
buffer[0]=__toascii(rx_buffer[0]);
m_kelvin_temp = buffer[0];
for(n=1;n<8;n++)
{
    buffer[n]=__toascii(rx_buffer[n]);
    m_kelvin_temp +=buffer[n];
}
shitallj, sre you still with us?
I'd say the Q is answered.