Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / April 2005

Tip: Looking for answers? Try searching our database.

problem to send data to Serial Port....?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kiran - 29 Apr 2005 14:40 GMT
Hi all,
 I have a problem to communicate with serial port(COM3:). I am able
to open the handle but cannot send any data.

  1. I connected my motoroala handset to PC through datacable.
  2. I installed valid driver to detec the motorla(V400) handset
  3. I tested the handset through Hypertermal and succssfully sending
any data.
  4. I opened the Control Panel -> Phone and Model window and clicked
the modem tab and I saw that the Motorola handset( Motorola USB modem
) is attached through COM3: port  fo the PC
  5. Then I created a sample C# program to communicate with handeset
through COM3 port . the code is like this:
 
string text = "AT+CKPD=";
int byteCnt = oEnc.GetByteCount(
text.ToCharArray(),0,text.Length,true);
byte[] Buffer = new byte[byteCnt];
int byteEncodeCount = oEnc.GetBytes( text.ToCharArray
),0,text.Length,Buffer,0,true);
hSerialPort = Serial.CreateFile( handleName, Serial.GENERIC_READ |
Serial.GENERIC_WRITE, 0 ,IntPtr.Zero,
                                Serial.OPEN_EXISTING, Serial.FILE_FLAG_OVERLAPPED, IntPtr.Zero
);

           
            if( hSerialPort.ToString() == "-1" )
            {

                    Console.WriteLine( "Un available");
            }

            int ch = 1;
            if( ch == 1 )
               Success = Serial.WriteFile( hSerialPort,Buffer,
Buffer.Length, out BytesWritten, IntPtr.Zero );

    When i debug the code the Serial.WriteFile method is return false
value. and I got the system error code using
Marshal.GetLastwin32Error(), it is giving 126 error code. I searched
in internet description of the 126 error , it says module not found.
    I don't know what to do. I  am imporing only Kernel32.dll in my
sample program. is anything i have to do..?
    please help me on the problem..

Thanks & Regards
kiran kumar
vemulakiran@gmail.com
Floyd Burger - 29 Apr 2005 16:03 GMT
Some of these devices can only be accessed using TAPI.  When you tried with
HyperTerminal did you open COM3 or the TAPI device by name?  Have you tried
with other serial communications libraries?  I use TransPort from
www.componentscience.net and am pretty happy with it.

Signature

Floyd

> Hi all,
>  I have a problem to communicate with serial port(COM3:). I am able
[quoted text clipped - 43 lines]
> kiran kumar
> vemulakiran@gmail.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.