Solved

reading electronic balance

Posted on 2002-05-31
8
202 Views
Last Modified: 2013-11-20
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.
0
Comment
Question by:shitallj
  • 3
8 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7047617
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().

0
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 7047698
Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwbgen/html/msdn_serial.asp ("Serial Communications in Win32") - it comes with a full-featured sample.
0
 

Expert Comment

by:vpomona
ID: 7047754
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];
}
0
 
LVL 86

Expert Comment

by:jkr
ID: 7138468
shitallj, sre you still with us?
0
 
LVL 86

Expert Comment

by:jkr
ID: 12036021
I'd say the Q is answered.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 176
twoTwo  challenge 35 101
post4 challenge 28 99
x-bar in Google Sheets 2 50
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now