Using ReadFile to receive circuit input:

This is a discussion on Using ReadFile to receive circuit input: within the Networking/Device Communication forums, part of the General Programming Boards category; Hello friends, I've been working on a program designed to communicate with a sensor circuit that reacts when it's signal ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    1

    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
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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, 01: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, 01:22 AM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 04:42 PM
  4. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 12:09 PM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21