Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HELLO,
I am trying to develop a little software fro keep record of weight in sql database. i am using c# environment. i am newbie to c# but coded as much as i can. i coded to get reading from indicator. but there is some problems,,
1. i cant get digits i am getting ? mark instead of actual reading.
2. my reading is 25.07 on indicator. but i m getting only 1 ? mark in return.
in hyper terminal i m getting actual readings but in my application i am getting problem.



Image1
Image2
Image3
Image4

What I have tried:

I am using port RS232. indicator Name (USA Inc DELTA-7). user mannual is attached.
Posted
Updated 10-Jul-18 7:22am
v2
Comments
Richard MacCutchan 9-Jul-18 3:04am    
You need to use your debugger to see exactly what values are returned by the device. Check the SDK guide to ensure your communications are correct. And finally, we cannot help without seeing your code.
Ghayyas Awan Mahtaab 9-Jul-18 4:10am    
Code Is Attached Below...Please review It

Start by checking your communications settings using HyperTerminal or similar - when you can read the data properly using that, transfer those settings (Baud rate, bits per char, parity, stop bits) into your code and see if you can duplicate what hyperterminal shows. Until you can do that, you can't be sure what the heck is happening!
 
Share this answer
 
Comments
CPallini 9-Jul-18 4:04am    
5.
Ghayyas Awan Mahtaab 9-Jul-18 13:30pm    
I made an app on vb for teating purpose...
I got some numeric values in vb app...but in inverse format...my load was 2.5 kgs but app was showing 005.2 in label text...
In vb i was near to success but dont know how can i get value in right format....
OriginalGriff 9-Jul-18 14:00pm    
So start with the debugger and see exactly what you are getting!
Ghayyas Awan Mahtaab 9-Jul-18 14:04pm    
Ok...I'll do it in the morning...
I'll post results tomorrow...
Thanx to all for being with me...and giving valueable time to me...
Ghayyas Awan Mahtaab 9-Jul-18 13:32pm    
My main project is in c#...
Can i add A vb form in it?...if yes then i would like to gt help about getting right results in right format...
Your opinion can lead me towards to success. Thanx in advance
"?" means that you need to retrieve / parse the "status byte" to get additional information about the current status of the scale (e.g. "in motion"; etc).
 
Share this answer
 
Comments
Ghayyas Awan Mahtaab 9-Jul-18 6:01am    
Scale is in stable condition...
if scale make any changes in reading....output in application blinks...
[no name] 9-Jul-18 12:46pm    
It's the "scale's" output that matters; not the "app".

The "app" is not interpreting the scale's response properly.

(I used "in motion" as an EXAMPLE; the fact that it is "stable" now does not mean it was stable THEN; or there was a DIFFERENT issue; that's what the "?" indicates.)

Ghayyas Awan Mahtaab 9-Jul-18 13:22pm    
Seriously i don't khow what to do...and where i am doing wrong...
[no name] 9-Jul-18 13:51pm    
The documentation you showed is for the "display"; it's useless for "communicating" with the scale.

And to properly communicate with a scale, you send a "command" and it gives a "response". The fact you are only "reading" doesn't make sense.
[no name] 9-Jul-18 14:29pm    
Get the proper "Technical Documentation" ("API").

Nothing else will do.
this discussion should be closed. i solved my issue leaving c# project. in vb.net i got the reading as i want. thanx to all friends being with me...
 
Share this answer
 
Comments
Patrice T 10-Jul-18 14:19pm    
The question is 'closed' by accepting useful solutions.
But someone can always post additional solutions.

By the way, this is not a solution and should be delete to prevent downvotes.
Member 13012922 19-Apr-19 16:29pm    
Ihave Same Issues .Can you send your solution for my email
mohgabar1@gmail.com
Code Which i am using is Here.
And Result is Also Attached here.
this result i got when the there was no load on Scale (0.00 kg).

Result Image

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;

namespace Test2
{
    public partial class Form1 : Form
    {
        int sec;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            serialPort1.Close();
            serialPort1.PortName = "COM1";
            serialPort1.BaudRate = 9600;
            serialPort1.Parity = Parity.None;
            serialPort1.DataBits = 8;
                serialPort1.StopBits=StopBits.One;
                serialPort1.ReceivedBytesThreshold = 1;
                serialPort1.DtrEnable = true;
                serialPort1.RtsEnable = true;
                serialPort1.Open();
                int reading = serialPort1.ReadByte();
                label1.Text = reading.ToString();
                
            timer1.Interval=1000;
            timer1.Enabled=true;



            sec = 0;

        }
        private void readData()
        {
            label1.Text = serialPort1.ReadExisting();
        
        
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            readData();
        }
    }
}
 
Share this answer
 
Comments
Richard MacCutchan 9-Jul-18 9:04am    
You read a single byte and display that as an integer value. Is that correct according to the documentation for the device?
Ghayyas Awan Mahtaab 9-Jul-18 11:48am    
My Scale Documentation is Attached in my first post. All lines i coded with the help of codeproject threads. but as i know every indicator has his different specifications and needs diferent settings..that's why i need help...because codes available on internet could noy fullfil my requirements....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900