Thread: Using ReadFile to receive circuit input:

  1. #1
    Registered User
    Join Date
    Apr 2011

    Post Using ReadFile to receive circuit input:

    Hello friends, I've been working on a program designed to communicate with a sensor circuit that reacts when it's signal gets excited, which then transmits a pulse to an embedded system that then translates the pulse into a 5v serial signal or bits that enter the computer and interact with our program.

    The idea is making a presence sensor that when interrupted, makes a LED shine and also lights up a lamp drawn with <winbgim.h>.

    The bits have to be processed from the circuit with the ReadFile command.

    The question is how can I use the ReadFile from the <windows.h> command to process the bits sent through the embedded system?
    Thanks in advance!

  2. #2
    Join Date
    Aug 2010
    Ontario Canada
    That will depend entirely upon how the uC connects to the PC... Serial ports are easy, just open them like files... USB devices that identify as drives or ports are similarly easy, just treat them as files.

    Open as file ... CreateFile Function (Windows)
    Configuration ... DeviceIoControl Function (Windows)
    Read as file.... ReadFile Function (Windows)

    You will need to #include <windows.h> and link with kernel32.lib.

    Where you get into trouble is when there is no driver and you need to talk directly to the port involved...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List from Standard Input
    By mercuryfrost in forum C Programming
    Replies: 14
    Last Post: 08-24-2009, 12:05 AM
  2. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 12:22 AM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 12:50 PM
Website Security Test