12 years ago.

How can I send my system time to mbed?

I want have a program that is divided into two parts, one computer side and one mbed side. The computer side sends the system time to the mbed side and the mbed side program will do some processing on it. My question is I cannot find a easy way to send the time to mbed using simply USB cable. Can anybody help me? Thanks.

2 Answers

12 years ago.

What programming language are you using for you pc-application?

I am using c.

posted by Boyu Fang 09 Dec 2012
12 years ago.

Have you worked through the USB HID pages to get the PC > MBed comms working?

The first step would be making them talk, then pulling the right system variable on the host PC side and sending that down the USB cable to the MBed.

I've managed to get this working for a program that graphs my PC temperatures and displays the time, for some reason the website isn't updating the code from the compiler, so I'm only showing a really old version. But as soon as I get it figured out, I'll publish it.

Matt

Thanks Matt, I will have a look at it. I just dont know which library I should use.

posted by Boyu Fang 09 Dec 2012

The post that was instrumental in me getting it to work is this one: http://mbed.org/users/mblokzijl/notebook/crysis-mbed/

Although thinking about it, that might be over-engineering if all you want to do s send the time once. You could do it over the USB serial connection that the MBed offers, that would be significantly easier and wouldn't need to mess with any USB coding.

posted by Matthew Green 09 Dec 2012

Umm... How can I send the time just use USB serial? I tried the examples in handbook but its just getc and putc, I cannot send a string to mbed. Cheers mate.

posted by Boyu Fang 09 Dec 2012

You'll want to use getc to get the info from the USB Serial port and on the Host side you'll need to find some C code to write the appropriate values to the right serial port. In my windows client code I'd done this originally and I can try and dig out the code if it'll help? (and you happen to be using a windows host)

Ok, the code I used was Visual C++ 2010 using the .Net framework, so I don't know how useful it would be, but I hacked it around from info on this page: http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx

posted by Matthew Green 10 Dec 2012

Cheers mate but I am using mac os so I will try to hack a little bit. Thanks for the help anyway.

posted by Boyu Fang 13 Dec 2012