AllExperts > Experts 
Search      

Active X Programming

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active X Programming Answers
Question Library

Ask a question about Active X Programming
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Abhijeet Landge
Expertise
I can answer questions about System Analysis, Database Design, mapping live systems into models. I can answer questions related to Visual Basic 6.0, databases and ActiveX programming Generating reports using Crystal Reports 7.0, passing parameters from VB Applications is another area where I can be of help. I cannot answer questions pertaining to COM / DCOM.

Experience
Developing Client Server Application in Visual Basic 6.0 and generating complex reports to the satisafaction of the end user using Crystal Reports 7

Education/Credentials
B. E. Computers
[Bachelor or Computer Engineering]

Awards and Honors
Won an Honor Mention in the ICPSC Contest organized by Wisconsin University

 
   

You are here:  Experts > Computing/Technology > Basic > Active X Programming > VB6 and Serial ports

Topic: Active X Programming



Expert: Abhijeet Landge
Date: 7/6/2001
Subject: VB6 and Serial ports

Question
Hi Landge,
Well I'm working on serial ports with Visual Basic 6 and I wanna know how can I manage the signals in the serial port pins. I want to send a signal from specified pin which I like and I want to figure out the pin of the signal that I receive. I didn't find anything helpful in MSDN library and I need an expertise. I want to develope a software with VB6 that show me all these stuffs (I also want to manipulate with the voltage of each pin).
Look at the following 9 pins,

D-Type-9 Pin No.   Abbreviation                    Full Name
Pin 3              TD                   Transmit Data
Pin 2              RD                   Receive Data
Pin 7              RTS                   Request To Send
Pin 8              CTS                   Clear To Send
Pin 6              DSR                   Data Set Ready
Pin 5              SG                   Signal Ground
Pin 1              CD                   Carrier Detect
Pin 4              DTR                   Data Terminal Ready
Pin 9              RI                   Ring Indicator

These are the pins that I mentioned above.Voltage sent over the pins can be in one of two states, On or Off. On (binary value "1") means that the pin is transmitting a signal between -3 and -25 volts, while Off (binary value "0") means that it is transmitting a signal between +3 and +25 volts... And want to send and receive my signals (Voltage) via these pins.
I would be very appreciated if you help me in this case.
Thanks
Hooman Sakaki

Answer
Hi Sakaki,
Sorry for the delay in answering the question. Manipulating Voltages and all should be easily possible once you can communicate using the ports.

I shall look up info related to VB 6.0 and let you know, but till that time here something to chow on

Opening a Port
Call the CreateFile function to open a serial port. Because hardware vendors and device driver developers can give any name to a port, an application should list the available ports and enable users to specify the port to open. If a port does not exist, CreateFile returns ERROR_FILE_NOT_FOUND, and users should be notified the port is not available.

// Open the serial port.
 hPort = CreateFile (lpszPortName, // Pointer to the name of the port
        GENERIC_READ | GENERIC_WRITE,
                      // Access (read-write) mode
        0,            // Share mode
        NULL,         // Pointer to the security attribute
        OPEN_EXISTING,// How to open the serial port
        0,            // Port attributes
        NULL);        // Handle to port with attribute
                      // to copy


2. CONFIGURING A SERIAL PORT
3. CONFIGURING TIMEOUTS
4. WRITING TO SERIAL PORTS
5. READING FROM SERIAL PORTS

depending on what values you read from the ports, you could very well manipulate the output signal.

you shall find more information at the following URL
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecomm/htm/ser...

I got this using the keywords ' serial port programming' in the MSDN [the one that is ONLINE]

Hope this helps.
regards
abhi


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.