473,788 Members | 2,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interfacing an Instrument thru RS232 using C#

3 New Member
Hi
I am from science background and learnt little bit of programming in C,Matlab,C#.
My task in hand is to interface an instrument through RS 232. I am using the serialport class but not able to communicate with the instrument . So kindly help me. Its completely educational purpose (no profit making) so reply soon.....
awaitng expert reply.......... ...........
Apr 11 '07 #1
5 8665
tifoso
41 New Member
What have u tried already?? It may be the external black box u r interfacing with
does not use the CTS/DTS handshaking?? Are u pairing the baud rate for both ends?? Do u have your serial cable tested??? GIve out more info and some hints will come your way

Ciao

Becker
Apr 11 '07 #2
nmsreddi
366 Contributor
Hello

As you said you are using serialport class ,i think you are using c# as your language,what methods you are using for interfacing ,how can you say the device is not interfacing with your application,hav e you tested the device by interfacing it with some other softwares,

more over can you give some specifications about your device which you are going to interface ,

if possible try to post some sample code so that we can under stand your actual point and can give the solution


Regards
N.Msreddy
Apr 12 '07 #3
Plater
7,872 Recognized Expert Expert
Try communicating with your instrument through HyperTerminal first. Then when creating your serialport class be sure to use the same baudrate and stop bits and other settings.
The SerialPort class in .NET2.0 is pretty unstable and rather tricky. You need to use the events that fire when data is recieved (Note: Do not actually try to read the data inside the eventhandler)

I am unsure how far you got with it but start with this?
SerialPorts are addressed by name (ie "COM1") if you need a list:
System.IO.Ports .SerialPort.Get PortNames();

I don't want to link to other helpsites but if you google "using SerialPort class in C#" you will get a number of examples better then I can explain
Apr 12 '07 #4
itsme321
3 New Member
thnx a lot for replying and sorry for a very late reply from my side .......... I was busy with something else ......... surely i'll come back soon with some more details whatever you need .............
Apr 20 '07 #5
itsme321
3 New Member
yes i'm doing the programming in C# language ......... and am using the srial port object and its methods to write and read data .......... basically i have to get the data sent from the instrument to the computer so that the analysis can be done easily using excel or any other application ........ and the data that the instrument sends is the wavelength and corresponding absorbance values ( in ascii ) ........... now let me tell you some details about the instrument's serial communication .......... its thru RS232C .......... and I have prepared the cable by following the pin configuration given in the instrument manual .............. what i feel that i'm doing mistake somewhere in the hand shaking part of the communication while reading the data .......... coz I have no problem at all when I send any data from my application ........... and the handshaking is thru RTS/CTS ............. so tell me now what should i do ............. i didnt find anything regarding asynchronous mode of reading data ........... so please guide me
Apr 21 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7825
by: Dan | last post by:
I wnat to see in browser an status from an device connected on rs232 port The java class for read from serial port is: //Serial.java import java.io.*; import java.util.*; import java.lang.*; import javax.comm.*;
8
2063
by: Terry Olsen | last post by:
I'm trying to use the RS232 class that was in the Platform SDK (i think). Has anyone else used this with events successfully? Here's what i've got: ====================== Public WithEvents bbsPort As Rs232 = New Rs232 With bbsPort .BaudRate = baud .DataBit = dataBits .Parity = parity .Port = comPort
13
6867
by: jay.dow | last post by:
I want to write to the pins of an RS232 without using the serial protocol. The use would be every pin could act to complete a circuit in customized hardware. I could use python to communicate serially to a BASIC stamp or a Javelin stamp and then use the stamp to set however many pins as 0's or 1's but should it be that hard to do with python. I've looked through how python does serial with the "serial" module but it just uses Java's...
4
5503
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened with: Public switchcom As New Rs232 switchcom.Open(2, 57600, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 512)
3
1434
by: lotus | last post by:
Hi all. I want to control two different instrtument but have simliar functionality. Acually the fisrt one is controlled by using serial communication, and the other is controlled by LAN communication. The number of instruments will be extetned by 5 or more. So If user select instrument (ex. by selection of combo box items), I must do right procedure of contolling proper instrument.
0
1042
by: Kean | last post by:
Hi gurus, I am facing a problem to send a 3 characters from my VB.net to LCD modules. I only able to get 1 character display on the LCD module. Dim sTx As String '---------------------- '// Clear Tx/Rx Buffers moRS232.PurgeBuffer(Rs232.PurgeBuffers.TxClear Or Rs232.PurgeBuffers.RXClear) sTx = txtTx.Text
1
3164
by: khizerbasith | last post by:
i need to interface vba in excel to interface it to rs232.need to send the message from the vba throught the rs232 port
0
1944
by: shehzadmajeed | last post by:
I am a Point of Sale Terminal Programmer/Developer and currently assigned to develop a VTI Simulator (Virtual Terminal Interface) than can exchange messages as per Specification through RS232-COM Port. Using VB MSCOMM ActiveX control, I am managed to receive Data from POS Terminal but when i try to send data (Less than 100 Bytes) to POS terminal, it works but doesn't work for data more than 99 Bytes. Following is the related coding part: ...
0
970
by: Terry Reedy | last post by:
Devarajulu, Baskar (D.) wrote: asap3lib.py is not part of the stdlib, and the error message is not very informative. Look at line 320 and see what might trigger the error.
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.