Tuesday, July 14, 2009

Help me regarding Computer Ports using C language?

Is there any way of sending a stream of bits from Serial or parallel port of my computer using C language?

Help me regarding Computer Ports using C language?
Try using functions like inport(for reading the port) and outport(for sending data to the port) in dos.h. These functions require a port no. where U want to send the data and the data (binary data converted into decimal, like U wanna active first 4 data pins of Ur parallel port and deactivate the remaining 4 then U can use the data 11110000, which when converted to decimal gives 240, so enter this value along with the port no. while calling the function).
Reply:Yes, in most compilers there are functions called inportB %26amp; outportB that are designed for that. Look in your compiler's docs. Also, you can open a file to either divice using a DOS name in a DOS environment. If, however, you want to create a Win32s API application, then you need to find the API calls to do this. Start at the URL below.
Reply:At codeproject you will find tons of ready projects with full sources.
Reply:Certainly. You write to the port just like writing to a file. That is, you create a handle to the "file" and write to it, then close it. I recommend reading the documentation.
Reply:yes i tcan be done........... but i donno how to do that...........

garden flowers

No comments:

Post a Comment