Connect with us

Digital Signal to PC via Serial Cable

Discussion in 'General Electronics' started by Richard, Feb 19, 2004.

  1. Richard

    Richard Guest

    I am working on a small project, and want to design a circuit that
    will interface with a PC via a serial cable.

    The circuit needs to pick up the state of a micro switch (on or off),
    and then send the signal to a PC via Serial Cable, where a Visual
    Basic program will pick up the COM state and react to the change in
    state.

    Can anyone suggest where to start.

    Cheers,


    Richard
     
  2. scada

    scada Guest

    Is it only one switch to monitor? If so, use the mscomm control to monitor
    one of the handshaking lines with the "OnComm" feature. Example: comEvCD
    (change in carrier detect line). Run your contact through an opto-isolator
    IC to fire up the LED (use isolated supply, not from the PC). Use the IC
    output to pulse the CD line of the RS232. Loop a program in VB to poll the
    port, then do what you need to do!
     
  3. Richard

    Richard Guest

    Is it only one switch to monitor? If so, use the mscomm control to monitor

    Yes it will be an optoswitch.

    I theory, I want to design a "makeshift" swipe card reader, so when a
    card breaks the optoswitch light, I want an LED1 (always on) to turn
    off, and LED2 (always off) to turn to indicate a successful login.

    I will use a VB program on teh PC to monitor the COM port for any
    activity.

    A design I was looking at/reseached, was a PIC 16F84 to control teh
    input (optoswitch) and the outputs (LED1 & LED2) and the output to a
    MAX232 to interface with the serial port which runs off to the PC with
    the VB program.
     
  4. scada

    scada Guest

    OK, that's good! You can have the PIC chip toggle the CD line (or whichever
    Handshake line you choose) or you could send a word back to the RS232 port!
    IE: Send an ASCII "A" (or whatever character you choose) would indicate an
    "on" condition. With the one ASCII word you can have 128 conditions (7 bit
    resolution)! But if your using the PIC 16F84, you will have to "Bit Bang"
    the code. Better off choosing a PIC chip with a USART built in!
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-