How to get data out of your Microcontroler and onto your PC - Page 1
Forum section: electronics / general

author: Feanor
author_rank: Regular Contributor
timestamp: October 08, 2010, 11:16:58 am
content: So how do you do it? A USB to serial adapter, a MAX232 chip and a UART port on the microcontroler? What happens on the PC side of things? Hyper-terminal? How do you set that up? Do you just store it as a text file?There are so many times when you need data on a PC for analysis, presentation, debugging and storage.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 08, 2010, 01:37:25 pm
content: HiThere are lots of ways to do it: ethernet, rs232, usb, parallel port (old pc's only), IrDA, Bluetooth, etc.The easiest one is RS232. You just write some code (Visual Basic or C) to read the RS232 port and receive data.I think you should shorten your questions to the specific communication you want to implement.

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: October 08, 2010, 03:14:08 pm
content: A couple UART-USB adapters are available on ebay that work well.There's aforum discussion hereand somehints to locate them here.

author: Strube09
author_rank: Regular Contributor
timestamp: October 08, 2010, 03:18:47 pm
content: Can anyone provide a snippet of code in C or C++ gathering data from the 232 on the computer.I can send data and receive data on the micro as there is plenty of info to do this... but every C and Cpp book I have read just teach you the language. They fail to show you how to use the IOs of a computer.Thanks,Strube

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 08, 2010, 03:54:28 pm
content: Quote from: Strube09 on October 08, 2010, 03:18:47 pmSure, just use Google Translator to understand what I wrote.http://www.todopic.com.ar/foros/index.php?topic=26052.0

author: DavidDLC
author_rank: Frequent Contributor
timestamp: October 08, 2010, 05:53:36 pm
content: There is also a hack for a USB-RS232 converter to eliminate the RS-232 to 5 Volts logic conversion:http://hackaday.com/2009/09/23/hacking-usb-serial-port-adapters/Check if there is useful information for you.

author: Rhythmtech
author_rank: Regular Contributor
timestamp: October 09, 2010, 04:57:48 am
content: To gather data as it is read and not record it directly onto the memory on the mcu you would need to send the data to a computer one reading/recordset at a time. If you are on WindowsSharpdevelopis a fairly easy way to development environment to access things like com ports. Debugging and help tools are a bit of a hurtle however since it is geared more towards programmers and not hobbyist. I have used VB6 for some very similar purposes at work to what you are trying to do, but not with an mcu and I can't really share the code... I can definitely help though, limited as I may be in understanding your mcu setup.If you use an On Comm event you can trigger data collection depending on input to the serial port, so basically you can have a serial event driven data collection every time your mcu sends data.Here's aC# tutorialthat looks decentSharpdevelop is a .NET development environment so it supports several other languages if you would rather try VB or a few others.O'Reilly also has this book coming out -Real World Instrumentation with Python, I am thinking about picking up since Python is probably a little more easy to tap into the C libraries that so much older equipment uses and still get some of the more modern advantages of newer languages. I am not experienced with Python, so I wouldn't take my comment as law, but maybe down the road a bit I'll have more to add.Seems like there was a data logger type project with software and everything for an Arduino. I know there is a fairly fancy one for the parallax -PLX-DAQThe other options would be to use Flash media like an SD card orusb memory stick, or use an EEPROM and then write an interface for the mcu to dump the data. The SD or USB memory might be a little easier since a card reader or usb port on a computer can be used to access the data directly. I am sure there are more possibilities.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 09, 2010, 07:47:33 am
content: Quote from: Strube09 on October 08, 2010, 03:18:47 pmIO implementation is different between machines and OS. so you have to search books like "Windows RS232 using C" or Linux/mac etc. I have a book "API How To" for a long time now that taught me the basic of calling "Windows API" in VB, but once you get the idea, you can apply it in C as well (of course you still need code examples). I suggest you go for API, coz thats the only thing that connects between you and your machine.... closely and formally.

author: Feanor
author_rank: Regular Contributor
timestamp: October 09, 2010, 01:07:42 pm
content: Thanks a lot guys, I now have a whole stack of options to research.I like the look of that UART to USB adapter. Got to get me one of those, then figure out how to access it. Probably going to have a crack with a C program first.Thanks again.

author: migsantiago
author_rank: Frequent Contributor
timestamp: October 09, 2010, 01:31:20 pm
content: You can use the MCP2200 from Microchip. It's a very small and affordable UART to USB converter.http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en546923

author: Rhythmtech
author_rank: Regular Contributor
timestamp: October 09, 2010, 08:09:02 pm
content: Serial Port Complete:COM Ports, USB Virtual COM Ports, and Ports for Embedded Systemsis a book I used several times as reference for not only some "light" embedded com stuff, but also a great reference for RS485 and other serial equipment interfaces. I've used some of the VB .NET comm code from the book successfully and the book is great in terms of the content to word count ratio.