The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 label control to open a rs232 port

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
luoyixin Posted - 10/13/2006 : 5:49:10 PM
Origin Version (Select Help-->About Origin):
Operating System:
We tried to connect a scale (ACCULAB-ALC MODELS) with RS232 PORT to one computer (xp pro). We have one line of code at the label control to open a port but it failed to work. "bal=rs.open(com2:96,n,8,1)"
My questions are:
1. Is this code the labtalk script or something else?
2. What does 'rs' here mean? Is this a self defined object or what?
3. How to define an object for labtalk?
Thanks.

peter
12   L A T E S T    R E P L I E S    (Newest First)
luoyixin Posted - 10/25/2006 : 6:21:43 PM
origin7.5 + winedge + RS232
Finally we make RS232 work.
1. Check the balance's port interface. Read the documents to find the balance's factory default settings for the RS232
a.(XP PRO) start ->all programs -> Accessories -> communications -> hyperterminal-> type in the parameters correctly
baud rate, stop bits, parity, handshaking
For Acculab:1200, 7, odd, 1 stopbit, XON/XOFF(handshaking)
For Ohaus:2400, 7 data bits no parity 2 stop bits and no hadshaking
The protocal is the extremely important to me.
b. Click the 'print' button, the value will show in the terminal

2. Setting the port at computer
control panel -> system -> device manager -> port -> settings. This setting should be same as your balance's settings.

3. Origin 7.5 is supposed to be able to read and write data from balance now. The sample code is at
http://www.originlab.com/FileExchange/details.aspx?fid=73 though it is useless to me.
Drag the package to your application and remember to drag the RS232Commands.c to the system folder on the right side to make sure
the compilation will be done each time when the origin application is opened.

4. I checked and tested the RS232Commands.c. To me, the object named 'g_ffComm' should be able to write and read from the port but it does not work.

5. Then we used a software named 'winedge' that support most windows applications running DDE. 'Winedge' could do the port settings and transfer data from balance to Origin applications. We have spend 90% of time working on connection.

Thanks to Hideo Fujii of OriginLab and Alex of winedge.
zachary_origin Posted - 10/18/2006 : 12:52:23 AM
Hi peter,

You can open Device Manager (Control Panel > Administrative Tools > Computer Management > Device Manager > Ports ) in the Windows os to see which port is used.
By the way, you can search in the net for some little applications on debugging serial port. Then you can use this to debug the hardwares between your computer and the device.

Zachary
OriginLab Technical Services.
luoyixin Posted - 10/17/2006 : 10:21:39 AM
Thank you, Zachary.

rs_open(1);
rs_config(96,8,0,1);
Error to configure the serial port.

No matter what I typed in the parameter for rs_open(), like rs_open(1), rs_open(2), rs_open(3),.. It always shows that COMx was opened successfully. Is it a bug? I am not sure whether the port was opened or not.

Though the problem was not solved, I still want to say that the technical support work of Originlab is great. Much, much better than Microsoft.

Thanks.
peter
zachary_origin Posted - 10/17/2006 : 02:47:23 AM
Hi Peter,

Have you noticed that there is a function named rs_config() in RS232Commands.c? You can use this function to configure the serial port. I do not know what does each of the parameters in rs.open(com2:96, n, 8, 1) exactly mean. Does 96 represent the BaudRate, n for none Parity , 8 for ByteSize and 1 for StopBits? I am not sure. If it is, you can replace
rs.open(com2:96, n, 8, 1)
with:
rs_open(2);//open COM2
rs_config(96, 8, 0, 1);//configure the port.


I can not test if it works for the scale. Could you try it and let me know the result?





Zachary
OriginLab Technical Services.

Edited by - zachary_origin on 10/17/2006 02:49:03 AM
luoyixin Posted - 10/16/2006 : 6:47:24 PM
Origin Version (Select Help-->About Origin): 6.1 pro
Operating System:xp pro
I have worked on this staff whole day without clue.
Here is my code
rs_open(1);
rs_write(\P\r);
sec -w 0.5;
rs_read(5000, %B);
%B=%[%B, 2:9];
x=%B;
plot -a %H 3 x;
type -b "show value of B = " %B " --end";
The script window shows that
"COM1 was already openned
COM was closed successfully"
The pop up window shows the value of %B is empty.
Our balance is "ACCULAB - ALC models- 110.4"
Thanks in advance for any more advices.

peter
luoyixin Posted - 10/16/2006 : 4:09:16 PM
We downloaded 7.5 demo and compiled and import RS232Commands.opk.
The label control of a button (open port) is 'rs_open(1);'. I click the button and nothing showed. Does anyone know how to update the script from rs.open(com2:96,n,8,1) to rs_open(1) and other command like rs.flush(i), rs.write(\P\r), rs.read(B), ...
easwar Posted - 10/16/2006 : 1:26:42 PM
Hi Peter,

The compiled files from Origin 7.5 will not work in 6.0. So you will need to upgrade to 7.5 to use this functionality. Please contact our technical sales department for details on pricing etc.

Easwar
OriginLab

luoyixin Posted - 10/16/2006 : 09:08:27 AM
Thank you, zachary.
I have already compiled RS232Commands by origin 7.5 demo. How can I import the compiled files or scripts to our program that runs at origin pro 6.0? Can we do that or not? How much will it be if we update our origin from 6.0 to 7.5?

peter
zachary_origin Posted - 10/15/2006 : 10:23:55 PM
Hi Peter,

It is not possible to use this in Origin 6.1 because this need compiled in OriginC, which is not supported until the version of 7.0. It will be much more convenient to programming with OriginC, which is very similar to C/C++, so a C-programmer can be familiar with it very easily. As for Origin vs. Excel, you can give a try on both of them and then make your decision.

Zachary
OriginLab Technical Services.
luoyixin Posted - 10/15/2006 : 5:57:48 PM
Hi, Zachary.
I downloaded a origin 7.5 demo as we are using 6.1 that does not have code builder. The RS232Command.c was compiled by using Origin 7.5. The problem is how to transfer the scripts like rs_open, rs_close,... from origin 7.5 to our program for origin 6.1. The scale company asked us to buy a software from their company and use excel to replace origin.

peter
luoyixin Posted - 10/15/2006 : 5:17:25 PM
Hi, Zachary.
Thank you for your reply.
I tried to use gcc and Visual C++ to compile the files, but failed as it could not find the 'origin.h'.
Could you give me more details about the compilation of the program?
"Add the RS232Commands.c file to your Code Builder workspace and compile and build the file.

To make this file part of every Origin session, add it to the System subfolder of your Code Builder workspace. "

How to open the code builder workspace?

Thanks.

peter
zachary_origin Posted - 10/14/2006 : 12:05:30 AM
Hi peter,

For communication through RS232 port, you can see this example:
..\Samples\Programming\Origin C Files\RS232.c

and this package in file exchange:
http://www.originlab.com/FileExchange/details.aspx?fid=73


Hope it helps,




Zachary
OriginLab Technical Services.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000