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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 RS 232, COM
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DrKlein

Albania
Posts

Posted - 09/12/2007 :  1:12:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.0
Operating System: Windows 2000

Hi,
I am trying to transmit data to an external device, connected to the computer via the RS-232 port (in my case: COM 1)

What I eventually want to do is clicking into a .bmp image, imported into Origin and having Origin send the coordinates to an external device, which moves to this position.

Anyway, my problems start much earlier:
I tried to communicate with a simple RS-232 device, tried the file RS232commands.c from the data exchange site and the RS232.c file shipped with Origin itself.Neither worked. Communication with Microsoft "Hyperterminal" works, though.
Required RS-232 Settings are
Baud Rate: 9600
Parity: none
Data bits: 8
stop bits: 1

I tried commands like (RS232commands.c):
rs_open(1);
rs_write("*rst\n");

result:
COM1 was opened successfully. (nothing else)

or with RS232.c:
rso 1;
rsw "*rst\n";

result:
COM1 was openned successfully.
6 bytes chars have been sent COM.

The command for the device is *rst and \n is the message terminator. Is the message terminator maybe the problem ? I tried it with and without.

In order to get to the final goal (clicking and transmitting via RS232, is Winedge maybe the better choice for that task ?


Sincerely

Oliver Kiowski

weberk

Germany
4 Posts

Posted - 12/30/2007 :  10:43:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hallo Oliver,

I just stumbled into a similar problem with Origin7.0 (and I realy do not whant to upgrade)...
Maybe it is causing your problem too:

There is a BUG inside the definitions in mscomm.h

if I write:
if ( !SetDCB( hCom, 19200, 8, 0, 1 ) )
it is working -
instead of:
//if ( !SetDCB( hCom, BAUD_19200, 8, NOPARITY, ONESTOPBIT ) )
which is not working...

best regards
Karsten Weber, Aschaffenburg, Germany
karstenfw(at)gmx.de


::::::::::::::::::::::::::::::::::::::::::::::::
theese values are defined here:

/*------------------------------------------------------------------------------*
* File Name: mscomm.h *
* Creation: JCG 8/22/2001 *
* Purpose: Origin C serial communication functions *
* Copyright (C) OriginLab Corp.2001 *
* All Rights Reserved *
*------------------------------------------------------------------------------*/


#ifndef _MSCOMM_
#define _MSCOMM_

#pragma dll(kernel32, system)


// Settable baud rates in the provider.
//FALSCH!!! Werte direkt einsetzen! KW 2007-12-31
// don't use - put in plain values instead
#define BAUD_075 ((DWORD)0x00000001)
#define BAUD_110 ((DWORD)0x00000002)
#define BAUD_134_5 ((DWORD)0x00000004)
#define BAUD_150 ((DWORD)0x00000008)
#define BAUD_300 ((DWORD)0x00000010)
#define BAUD_600 ((DWORD)0x00000020)
#define BAUD_1200 ((DWORD)0x00000040)
#define BAUD_1800 ((DWORD)0x00000080)
#define BAUD_2400 ((DWORD)0x00000100)
#define BAUD_4800 ((DWORD)0x00000200)
#define BAUD_7200 ((DWORD)0x00000400)
#define BAUD_9600 ((DWORD)0x00000800)
#define BAUD_14400 ((DWORD)0x00001000)
#define BAUD_19200 ((DWORD)0x00002000)
#define BAUD_38400 ((DWORD)0x00004000)
#define BAUD_56K ((DWORD)0x00008000)
#define BAUD_128K ((DWORD)0x00010000)
#define BAUD_115200 ((DWORD)0x00020000)
#define BAUD_57600 ((DWORD)0x00040000)
#define BAUD_USER ((DWORD)0x10000000)
...



Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000