473,699 Members | 2,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Port Access using axMSComm

Hi,

I am trying to read serial port using the MSComm control in
VS.NET2003(refe rred from the VS6.0). I have the code already in VB6
which I am coding to C#.NET.

After setting all the required settings of the COM1 Port

Dim buffer As Variant
Dim arr() As Byte
Dim myByte as string
buffer = MSComm1.Input
arr=buffer
myByte=arr[0]

Then comes the calculation part.
if((int)myByte= ..)

For my first click on a drawing Board connected thru COM1, I am getting
myByte value as 132.(Same for all the initial clicks)

Now in C#,

string myByte=axMSComm 1.Input.ToStrin g();
ASCIIEncoding encoding=new ASCIIEncoding() ;
testByte=encodi ng.GetBytes(myB yte);
int myFirstPoint=(i nt)(testByte [0]);

I am not getting the value 132,rather i m geting 63.
Please can anyone let me know the reason for this?

Both codes work for the same purpose but with different outputs.
Because we do not have a variant in C#(object is present but..) I am
not able to cast to the required result..

Please help me out in this regard..

Thank you

Nov 17 '05 #1
0 2134

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9091
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the same port to change the direction of the robot. The trajectory frame is managed by an applet, and the project works good when the applet is called by a html document allocated in the same local machine under W98 where the classes and the serial port...
6
6978
by: Peter Krikelis | last post by:
Hi All, I am having a problem setting up input mode for serial communications. (Sorry about the long code post). The following code is what I use to set up my comm port.
13
4823
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have been told it is not possible to access the serial ports from asp.net. The application is used to control custom hardware. The hardware is connected to a PC through serial ports. Our customer wants to control the hardware from a remote...
4
11196
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. What I would like to do is make the serial port accessible via a web service. The web service and the legacy application would be running on the same machine. The mobile application would access the web service via a network connection. It...
0
1594
by: shawnn | last post by:
Hello, I am able to get a list of ports using the System.Management classes. Win32_SerialPort has data members for port name, baud rate, etc, etc... but no entry for port index number. I need to map Win32_SerialPort's to indicies to set AxMSCommLib.AxMSComm.CommPort for read/write port access. How can I get a port number given a Win32_SerialPort? One way I can think of is to parse the deviceid string for trailing numerals and use that...
4
3377
by: Dave Cullen | last post by:
I need help using the serial port under VB.NET. I found a control called AxMSComm which I assume is the comm control, but there's no documentation in my MSDN help. Where can I find descriptions of the methods and properties of this control? And why doesn't MSDN have it? Thanks
38
9656
by: shussai2 | last post by:
Hi, I am trying to access Serial Port in XP. I am using Dev-C++ IDE that uses Mingw as a compiler. I just want to know how I can open up serial port on COM1 and write some data. I have searched quite a bit over the web and could not find anything useful. I don't want to use Visual C++ or Cygwin, linux, etc. If any of you guys have some little tid bit of code that would be great to look at.
0
4498
by: nmsreddi | last post by:
Hi friends I am working on c#.net . i am developing a windows application using c# 2003 aim of my application is sending and receiving sms using GSM modem. for this i am using AxMscomm control which is there in VB6.0(telephone device) by using this i am able to receive the data and able to send message .but the
2
5429
by: colin | last post by:
Hi, Im having a tiresome amount of trouble with using a bluetooth serial link. The receiving end is a bluetooth-rs232 module conected to my embeded system. The PC has a little usb bluetooth dongle, ive tried a another dongle with widicom software as I was having problems with the IVT bluesoleil software. that seems to have got rid of some other problems,
0
8685
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
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
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
9032
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
8905
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
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3053
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
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.