write a program

This is a discussion on write a program within the C Programming forums, part of the General Programming Boards category; hi was it able to write a program than run by computer and control by electronic hardware by serial port? ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    7

    write a program

    hi

    was it able to write a program than run by computer and control by electronic hardware by serial port?

    example like
    need a program to play sound than control by 5 sensor.
    the sensor will giving 0001 to 1111 bit...
    each but will generate different sound,.was able to do so ?

    TQ

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can probably do that, but you'll have to be much more detailed in what the interface you expect to have from one piece of hardware (e.g. a PC) and the other piece (e.g. a board with sensors).

    --
    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.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    7
    can say as

    u got 5 sensor, will giving input to computer by serial port.
    and the program is need to be play each guitar chord by the input from the sensor.
    like the sensor giving 1010 input., assume 1010 is for C chord. than the program will play the C chord sound though computer...


    was it able to do so?
    and was it hard to write and which program is the best for write this program?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    No, that's not sufficient to tell what you need to do.

    Does this board already exist? Is there a web-site for it?
    What is the actual interface on the "sensor" board? Is ia asynchronous or synchronous serial port? What kind of serial connector is it?

    --
    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
    Join Date
    Dec 2007
    Posts
    7
    not yet have. i just plan to do so./........

    the sensor i using is flex sensor..
    go i will make the board by giving 4bit signal to the computer..
    about asynchronous or synchronous , i not sure yet..
    actually wat is the different? and which is the best?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Right, so you're just planning the hardware right now.

    What, besides sensors do you plan on putting on the board?

    Can you point to a datasheet for the sensors?

    Which is better of synch or asynch depends very much on what you actually are trying to achieve, as well as "what the hardware can do".

    It may even be simpler to connect to the parallel port of the PC, rather than via serial - but again, it depends on what hardware you have, and how it works.

    --
    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.

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    7
    the sensor i using is flex sensor, and i will use PIC chip to connect to it and will generate
    0000,0001,0002 to 1111 of different input to the computer

    i just need the computer receive the input and read it..
    and generate the according sound regrading to the input..
    can say like a electronic keyboard..

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Right, so the PIC chip you have, presumably has a USART, which supports asynch output, which would make most sense here.

    Then it's up to the PIC to encode/decode packages of data from/to the serial port.

    --
    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.

  9. #9
    Registered User
    Join Date
    Dec 2007
    Posts
    7
    OK,
    than how should the program will be write?
    cause i dunno much about programinig..
    what i doing is hard hardware....
    can guide me pls..
    tqtq

  10. #10
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Before the program can be written, I believe you need to specify EXACTLY what you want the program to do.

    If the board is simply going to request your program to play a note on the computers speakers, then why not use the keyboard for this? User presses 'A', key, and the computer plays an A on the speaker, etc.

    I don't see why you have the extra board and need the serial communication, yet.

    Is this board going to be the interface for something like a keyboard, perhaps?

  11. #11
    Registered User
    Join Date
    Dec 2007
    Posts
    7
    cause i plan to make a virtual guitar using wireless
    so i will attach the sensor at the glove and play like playing a guitar...
    so i need to have program to generate sound to me......

    the program is need to generate each chord of the sound when i move the sensor...

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    Rather than trying to imagine (and write) the whole thing in one go, try to think up useful components which you might be able to adapt later on, or experiments which might help you understand what needs to be done.

    Your first challenge would seem to be just to get the PIC to do anything at all. Start simple, say light an LED or send a character back to your PC over the serial line.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  13. #13
    Registered User
    Join Date
    Dec 2007
    Posts
    7
    i have all the component already,, like pic and even mega32 microcontroller

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    I mean component in the software sense as well, say for example a few handy routines for sending / receiving data over the serial line.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie needs help..
    By xpress urself in forum C++ Programming
    Replies: 3
    Last Post: 07-26-2007, 08:22 PM
  2. how could i write this program: cat < apa | wc | wc > bepa
    By strugglingman in forum C Programming
    Replies: 2
    Last Post: 04-26-2006, 05:40 PM
  3. Is there another way to write this program?
    By agentxx04 in forum C Programming
    Replies: 1
    Last Post: 11-23-2004, 09:28 PM
  4. Replies: 1
    Last Post: 10-13-2004, 01:15 PM
  5. Challenge to write a program
    By Twisted.alice in forum A Brief History of Cprogramming.com
    Replies: 40
    Last Post: 05-15-2003, 01:00 PM

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