Thread: Interfacing a Simple Assembled Hardware device with the PC using C/C++

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    4

    Question Interfacing a Simple Assembled Hardware device with the PC using C/C++

    Hello!! This is my first post in this forum and I hope I dont bother you with my problem. You see, Im not a Hardware programmer, I kinda of a wannabe. Ok lets go to the problem.

    I have this friend that assembled a little machine to simulate a voting proccess, in this voting proccess the users (the voters) have only 2 choices [YES] of [NO] and the machine counts the votes and shows them in displays. The CKT used a PIC MC, the displays and other weird things I dont know what they are.

    My friend wants me to create an Interface program to work with the device from the PC (running Windows). The program is to make user job easier and prettier. The machine works by itself but the Idea is that through the software the User can be prompted to Enter its vote (press the buttons of the machine), the software will Display the current values of the votes, the operator of the software will be able to end the program and finally display the Winner of the election.

    Now here is the deal:

    1. I havent seen the CKT so I dont have access to it right now.
    2. I know it will be linked with the Computer through the COM ports (or is it LPT?, I know are the ones used also for Printers)
    3. I Dont need help to develop the program I just talked about in the previous lines... what I need is help to get started the communication.

    You see, that is the problem. How do I communicate my software with that device? How does it work?

    I know I'll probably use the
    Code:
    outp
    and
    Code:
    inp
    functions or other similars. But that is not what worries me, what worries me is things like getting the address of the ports, knowing what Im receiving when I'll be reading the input from the hardware and that stuff.

    Notice this is the first time I do such task so I know to little about it, I'd appreciate any kind of help. For me would be great to help my friend out and understand how to do this kind of stuff since I believe is more powerfull than the conventional programming desktop style I am used to.

    Finally here Im providing the maps for the CKT and stuff, I dont understand them, but I also have been told that I really dont need to. (Id like to, but that is too much to ask)

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    4
    Here is a DOC file, 2 pages containing both 1 image with the CKT!

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I know I'll probably use the outp and inp
    These are only really useful if your OS is DOS.

    Which leads to the first question.
    What OS and compiler do you have?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    4
    Sorry I didnt say it before, my mistake.

    My OS is Windows 2000 or Windows XP Proffesional.

  5. #5
    Registered User
    Join Date
    Feb 2005
    Posts
    4

    Smile

    Its been more than a week and I must confess, I thought this topic were interesting enough, specially for a C forum on communications... well I really hope someone feels interested to help me here. You see, there is no urge now since the project is been abandoned... but not for me I stull desire to learn this and because and such I newbie I wanna give the first step into this subject. Thanks for anything.

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    You didn't say what compiler you are using though...that's important if you want help with implementing it.

    what worries me is things like getting the address of the ports, knowing what Im receiving when I'll be reading the input from the hardware and that stuff.
    As for getting the address of the ports, in Win32, you don't. Serial ports are opened and closed like files with the CreateFile and CloseHandle API functions. I doubt whether you would be using the parallel ports, because those aren't really for interactive communications. Sometimes they are, but mostly they are for output only.

    MSDN has a large section devoted to communication resources, you need to read that.

    In order to know what you will receive, or what you should send, depends on your application layer messaging protocol. The documentation for your device should say what it is. I can't read the document you posted, because I'm too cheap to buy MS Word.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Building a SIMPLE computer device
    By Coder87C in forum Windows Programming
    Replies: 0
    Last Post: 05-09-2004, 10:39 PM
  4. Diving into Windows based hardware device drivers
    By AsAdi in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2003, 04:25 PM
  5. Diving into hardware device driver in Windows
    By AsAdi in forum Windows Programming
    Replies: 1
    Last Post: 02-01-2003, 03:30 AM