Find the answer to your Linux question:
Results 1 to 5 of 5
Hi i am using a PC104 with Linux and i need to control it with a controller that is connected via RS-232 or USB port. I need to launch one ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    11

    Launch application with RS-232 message

    Hi i am using a PC104 with Linux and i need to control it with a controller that is connected via RS-232 or USB port. I need to launch one or more application some specific message come through RS-232 port. Is that doable? If yes how? I am beginner with C++ on Linux so i don't really know specif libraries. If possible i would like to use pure C and not C++.

    Thank you!

  2. #2
    Linux Newbie theNbomr's Avatar
    Join Date
    May 2007
    Location
    BC Canada
    Posts
    150
    Your request is a bit, make that a lot, unusual. Do you really mean you need to control Linux from a RS-232 connected device? If so, please explain what manner of control you need to give it.
    Normally, Linux would do the controlling, and some device on the end of the serial cable does the repsonding. If this is actually the case, you will need to write code to send data on the serial port, and to read potential replies, also on the serial port.
    You should begin at the beginining, of course, and maek sure your hardware is working, before testing any software. Get a program like minicom or C-Kermit (most preferred), and try using it to talk to the device, over the serial port. On Linux, serial ports are sually named something like /dev/ttyS0, /dev/ttyS1, etc. You will need to configure the port parameters to match those required by the remote device. With luck, the remote device will communicate using human-readable string data, and will respond to the same type of data. You will also need to make sure your cable is correctly configured. Not all serail cables are creatred equal, and you must match the Rx, Tx, Gnd, and possible other pins or combinations of other pins.
    Once you've done al that, and got the hardware working with known-good software, you should read:

    Serial Programming Guide for POSIX Operating Systems
    Serial Programming HOWTO
    Serial HOWTO

    These will give you a good starting point for writing your application(s).

    --- rod.
    Stuff happens. Then stays happened.

  3. #3
    Just Joined!
    Join Date
    May 2010
    Posts
    11
    Well first of all.. no .. the first request comes from the RS-232 port and not Linux. Would work something like a keyboard shortcut. Don't worry about the device. I am the on that is making it. The device itself is going to be a microcontroler with some buttons and a LCD Display. Thats going to be the main interface with the PC/104 as it is not going to have an usual display. The PC/104 is going to be used to run some control algorithms with some sensors and actuators conected with a RS-485 bus to a custom RS-485 to PCI FPGA board. So as i don't have a key board and a Display i need someway to run.. stop and shutdown the PC/104 .. thats why i am using this control. But as i wrote before... it should works as keyboard shortcuts. After the program is running its easy to stop it and close it. I can make that at windos easily. But to launch it is a real problem even at windows. I am going take a look at your starting points. But i dont think i am going to find this answer over there. Let me know if i wasnt clear enough.

    PS: I am not sure if i am using USB or RS-232 but most probably RS-232.

    Thank you!!

  4. #4
    Linux Newbie theNbomr's Avatar
    Join Date
    May 2007
    Location
    BC Canada
    Posts
    150
    Okay, I get it. Using RS-232 will be much easier than USB. You could always just make your PC/104 linux boot to a serial console. From there, your serial microcontroller can issue strings of whatever flavor it needs.
    In your Linux inittab you would spawn a custom application whose stadard input is a serial port. Your uController would then communicate with that. No login required, and the application gets launched automatically at boot time. In this scenario, I think if your application just reads/writes standard input and standard output, the serial interface is already looked after by the init process.
    Interesting concept; I think I'll play around with it a bit, and maybe post back a bit of a recipe.

    --- rod.
    Stuff happens. Then stays happened.

  5. #5
    Just Joined!
    Join Date
    May 2010
    Posts
    11
    Sorry for taking so long to reply. First of all thank you for all the help. After making some homework at google i found out that inittab would be something very useful. Would what THIS website describe what you mean? But i have 2 questions. First .. if i boot on serial console, would i be able to use my custom made PCI card? Becouse it is going to use a specific driver. And second, using something as respawn at inittab... how that would affect my processing time? Would that make everything else stuck?

    Thank you.

    PS: I am going to take some long to run some real tests becouse i dont have any PC with rs-232 port available right now. And thank you if you can create some simple recipe.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...