NIC Programming

Posted on 2004-10-26
Last Modified: 2008-02-01
I'm planning to make use of the NIC to control and read devices (such as Ph Device, Airconditioners, etc.) since there are 2 input and 2 output if you use ethernet. Any help regarding how to control NIC. I believe it would be possible for Parallel printer port and serial port but I don't know if it's possible for Network INterface Card. Any information is highly appreciated. Thanks!
Question by:sinnedph
    LVL 55

    Accepted Solution

    You have not any possibility to control NIC to produce your own signals, because transmision protocol is hardwired in NIC's logic. It is not like serial or parallel where you have the possibility to control state of individual pins. Even more, Ethernet signal is differential type, so a pair of lines produces a signal together, no individual pin signal.
    The best you can do with Ethernet is to use Embedded Ethernet microcontroller cards, like those produced by EDTP Electronics:
    Then you have to program and connect each card ($70-$80 each) to each or more than one device. Microcontroller is programmed in C or Assembler. In your PC, just have to build an application with Visual C++ or VB with socket transmissions in UDP mode in order to "talk" with microcontroller cards.
    LVL 12

    Assisted Solution


    As Jaime said, you'll be better off using the parallel port or a USB port of your PC for things like this.

    Programming the parallel port can be a tricky; essentially, you need direct access to the hardware in order to control the individual bits. It's easy in MS-DOS (if that's sufficient for you), it's a bit more difficult in Windows (needs a driver).

    Alternatively, it might be easier to use a USB device which already contains isolated inputs and outputs (check, for example, You have to spend some money, but you get a complete hardware device including drivers and software to control it.

    Whenever possible, I'd suggest using a separate device which is very well insulated (it's probably cheaper to buy a new one than to replace the motherboard if something goes wrong).

    HTH, J
    LVL 55

    Expert Comment

    by:Jaime Olivares
    As a personal experience, I recommend you to use Ethernet ports instead of USB for many reasons:
    - USB is harder to program than Ethernet, Ethernet is as easy as create a Socket object and use Send() function
    - USB microcontrollers are harder to program than Ethernet
    - USB is intended for near peripherals not for mid- and long-distances
    - USB hardware is less fail tolerant, it is easier to build a ethernet cable than a USB cable
    LVL 12

    Expert Comment

    Well, it certainly depends on the requirements.

    The USB module I thought of contains insulated inputs and outputs, so it shouldn't be sensible at all to external influences - you can even connect certain devices directly to the inputs, as long as the voltage is below 24V. The outputs are protected by relays, so you again can connect low-voltage devices directly without additional electronics. I would imagine that programming them with the included software modules is just a matter of a function call (something like Port1 = FALSE). I'm not sure about this, though; check the docs.

    For most other ports (Ethernet, parallel port, serial port, etc.) you'll need additional hardware for the insulation and protection of the main board - add this to the cost of the chip, and you'll end up at similar prices ($100+), without accounting for the time required to assemble the device.

    But of course, for long distances, Ethernet is a good solution. You could also use RS485 (can be used over Ethernet cable, is much less sensitive to electronic noise, allows for distances of several 100 feet). Or you could use a TCP/IP-to-Serial converter with additional logic and hardware and transmit the signals over a WLAN. Or use two TCP/IP-over-Powerline adapters and again a TCP/IP-to-serial converter. There are probably many more options. It all depends on what you need and want to spend in terms of money and effort.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: JavaScript Coding - Massive 12-Part Bundle

    Regardless of your programming skill level, you'll go from basics to advanced concepts in a vast array of JavaScript subjects including Sammy.js, Agility.js, Ember.js, Node.js, jQuery, AJAX, Extjs, AngularJS, Knockout.js, and JSON.

    There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
    This article will show, step by step, how to integrate R code into a R Sweave document
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    5 Experts available now in Live!

    Get 1:1 Help Now