Thread: Best Approach for data capture (rs232)

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    26

    Talking Best Approach for data capture (rs232)

    Hi,

    I am wondering if anybody can point me into the right direction as I am very new to linux operating systems....

    Im working on crossbow mica2 hardware (wireless sensor networks) using TinyOS on linux - xubuntos to be precise.

    My ambition is to create a program that will automatically capture the data and create a file containing the data while streaming through rs232 cable (serial to usb converter) which is also connected to the base station at the other end. I can see the packets/data streaming in the terminal.


    I would prefer to do the coding in C I think I have a fair idea to do this. But in Linux everything is a file.

    How can I do this on Linux?


    (port number is /dev/ttyUSB0 which is COM1 windows equivalent)

    Thanks
    Last edited by Lego_TeCh; 03-05-2011 at 07:29 AM.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    I find this document a valuable resource for Linux serial ports: Serial Programming Guide.

    Jim

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    26
    Thanks for the input Jim.

    But how do I implement the code? For example the program I am trying to monitor is written in nesC so do I put the file in the same directory or do I integrate it in other coding programs.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    The link I gave you would be for the PC running regular Linux. Not the Virtual Box tinyOs (xubuntos). The tinyOs has serial port routines available that you would program with nesC.
    My ambition is to create a program that will automatically capture the data and create a file containing the data while streaming through rs232 cable (serial to usb converter) which is also connected to the base station at the other end.
    Where do you want to capture this data? On a regular PC running a Desktop operating system? On your Virtual Box? What do you mean by base station? A simple drawing of your network layout would probably help.

    I can see the packets/data streaming in the terminal.
    Where is this terminal running? In the VB tinyOs ?


    Jim

  5. #5
    Registered User
    Join Date
    Jul 2009
    Posts
    26
    Quote Originally Posted by jimblumberg View Post
    The link I gave you would be for the PC running regular Linux. Not the Virtual Box tinyOs (xubuntos). The tinyOs has serial port routines available that you would program with nesC.


    Where do you want to capture this data? On a regular PC running a Desktop operating system? On your Virtual Box? What do you mean by base station? A simple drawing of your network layout would probably help.



    Where is this terminal running? In the VB tinyOs ?


    Jim
    Sorry for being vague...

    The base station device is for programming the motes(sensor devices), base station has rs232 serial port. I want to capture the data of the network infrastructure in real time via usb port.Using windows XP the terminal is in the virtual box tinyOS.

    I dont think there is a need for a network layout but here is a few examples - MOTE-KIT4X0 MICA2 KIT & Lesson 6: Displaying Data on a PC.

    rs232 cable link - FTDI Chip | Semiconductors | Development Kits | Communication | Serial I/O Peripherals |US232R-100-BLK


    I just want create a program in C to put raw data of each packet received from the serial port into a file. So I can keep them as records.


    Thanks

  6. #6
    Registered User
    Join Date
    Oct 2005
    Posts
    12
    The rs232 is the Texas Instruments kit correct? If so, I think its important to note that you do not need to do any actual SPI programming (write the drivers for it) because its built into it. I think what you're trying to ask is how do you read from the USB drive itself into your c program? Am I understanding that correctly?

  7. #7
    Registered User
    Join Date
    Jul 2009
    Posts
    26
    Quote Originally Posted by Stiks View Post
    The rs232 is the Texas Instruments kit correct? If so, I think its important to note that you do not need to do any actual SPI programming (write the drivers for it) because its built into it. I think what you're trying to ask is how do you read from the USB drive itself into your c program? Am I understanding that correctly?
    Well rs232 is made by FTDI chip but overall yes I want to know how do I read from the USB drive itself into your c program.

    How do I do this?

    Thanks
    Last edited by Lego_TeCh; 03-09-2011 at 01:24 PM.

  8. #8
    Registered User
    Join Date
    Oct 2005
    Posts
    12
    Okay, theres a library in C for checking for connected devices. Check this out I know its in C++ but its similar and the library function is for C too:

    Introduction To Using LibUSB-1.0 - C++ Tutorials | Dream.In.Code

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and RS232 problem
    By gda in forum Linux Programming
    Replies: 4
    Last Post: 11-25-2009, 06:19 AM
  2. thread pool approach
    By fguy817817 in forum C Programming
    Replies: 3
    Last Post: 11-04-2009, 12:59 PM
  3. DShow: capture and mux to memory
    By ethemind in forum C++ Programming
    Replies: 1
    Last Post: 06-28-2008, 11:54 AM
  4. WebCam Capture, and display
    By simly01 in forum Windows Programming
    Replies: 1
    Last Post: 06-26-2002, 12:16 AM
  5. Screen capture problem....my code!(PLEASE READ!)
    By SyntaxBubble in forum Windows Programming
    Replies: 0
    Last Post: 05-02-2002, 05:07 PM