Thread: C Programming for LED circuit

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    4

    C Programming for LED circuit

    The basic circuit I want to interface to looks like this--

    http://i221.photobucket.com/albums/d...g?t=1190091880


    OS:Windows XP
    C Compiler- Borland TC++v5.5
    MATLAB v7.0, MATLAB Compiler v4.0

    As I am quite a novice in programming, I haven't been able to figure out how to program this circuit in C. As you can see, my interface is via serial port of a PC.

    What I want to do is that there should be 3 cases total, first 2 cases where each of these LEDs would flash individually, the third case being where both alternately flash in turns. LED requires a DC supply of approximately 1.5 volts across which a serial pin can provide. The ideal baud rate would be something that is equivalent to constant voltage....string of bits denoting HIGH level. So there would be no reading, just writing to individual pins, sending a string of 1s to empower the LEDs. No polling, no sending out messages etc

    I intend to interface a different program (MATLAB) to the executable. Please note I cant use any programmer IC on board to keep it simple. Is this plausible?

    I do hope this makes sense.
    Thanks in advance.
    Last edited by vivharv; 09-17-2007 at 11:58 PM. Reason: More details

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Which Operating system is running on your PC?
    Which C compiler do you have installed?

    Plus, I'm only mentioning RTS and DTR so that I don't have to keep referring to the image.
    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.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    4
    OS is Windows, Borland TC++ v5.5, I am sorry to not mention that b4...Thanks

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It is very likely that Turbo C can't use it's normal interface for the Com-port. You should really consider using a more modern compiler, and using the Windows COM-port API.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    This is one of those site which using Turbo C compile for serial porgramming. Serial Port. But it is strongly recommanded not to use this compiler ay furthure. Since you wont get any support on it. Consider upgrading your compiler to gcc

    ssharish

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Circuit Reliability program
    By Northstar in forum C Programming
    Replies: 1
    Last Post: 12-04-2007, 02:01 AM
  2. logic circuit truth table
    By botakis in forum C Programming
    Replies: 3
    Last Post: 11-18-2004, 11:02 AM
  3. eulers circuit
    By zarganah in forum C++ Programming
    Replies: 4
    Last Post: 11-15-2004, 06:25 PM
  4. Circuit Boards - probably a dumb question
    By sean in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-09-2003, 05:44 PM
  5. circuit
    By theOracle in forum C++ Programming
    Replies: 13
    Last Post: 05-18-2003, 07:14 PM