Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumSuggestionsSoftware Suggestions › How about a micros() function?

Page Index Toggle Pages: 1
How about a micros() function? (Read 16061 times)
07/31/06 at 07:19:42

justy   Offline
YaBB Newbies
Got Oscilloscope?
Sydney, Australia

Posts: 10
*
 
How about a micros() function that would return the number of microseconds since the board was reset?

-Justy
 
IP Logged
 
Reply #1 - 07/31/06 at 20:22:18

Forum Admin   Offline
YaBB Administrator
I love YaBB 1 Gold - SP
1.3!
YaBB Admin Land

Posts: 1
*****
 
What would you like to do with this function? I was refreshing a screen once, and seemed interesting to have such a function, but I am curious on your application for it.
 
IP Logged
 
Reply #2 - 08/03/06 at 08:10:10

justy   Offline
YaBB Newbies
Got Oscilloscope?
Sydney, Australia

Posts: 10
*
 
I'm developing a simple IR communications protocol.  I'm using the millis() function to see how much time has elapsed inbetween pulses.  If I had a micros() function, I could make it run up to 1000 times faster.   Cool
 
IP Logged
 
Reply #3 - 08/03/06 at 20:49:53

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
have you found an alternative way of doing it?
 
IP Logged
 
Reply #4 - 08/04/06 at 08:54:07

justy   Offline
YaBB Newbies
Got Oscilloscope?
Sydney, Australia

Posts: 10
*
 
I'm using millis(), but of course the smallest period of time I can check has elapsed is 1 millisecond.  It'll be OK for what I'm doing, as I only need to send 5-10 bytes.

I looked through the source for the core Wiring library, but only found a .h file.  Is it possible to use .cpp so that I can hack my own?  I'd be happy to share any results/success with the Wiring community.  Speaking of which, when I get my IR livrary working, I'll share that.
 
IP Logged
 
Reply #5 - 08/04/06 at 19:57:50

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
That's very cool, check out this library template: http://wiring.org.co/cgi-bin/yabb/YaBB.pl?board=Library_writers
 
IP Logged
 
Reply #6 - 08/07/06 at 03:19:15

justy   Offline
YaBB Newbies
Got Oscilloscope?
Sydney, Australia

Posts: 10
*
 
Yep, I've seen it, and it's really opened things up for me.  I use it even just to hide certain lower level functions to keep the Wiring code neat.  I was pleased when I could just paste in code from Wiring, add an entry in the .h, and away I went!
 
IP Logged
 
Reply #7 - 12/03/06 at 07:05:40

tylerfurtwangler   Offline
YaBB Newbies

Posts: 8
*
 
I too would like to know if this is a possibility.  Ive began writing my own library, however i dotn know how to access some of the microcontroller specific details.  I imagine a microsecond function would be easy to write if i could figure out the current clock cycle / freq. of the controller.  is there any resources available for me to look at to write my own libraries?
 
IP Logged
 
Reply #8 - 12/03/06 at 07:42:50

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi, yes there are some notes here: http://wiring.org.co/cgi-bin/yabb/YaBB.pl?board=Library_writers also the source code is available here http://wcvs.uniandes.edu.co

best,
 
IP Logged
 
Reply #9 - 12/03/06 at 08:32:44

tylerfurtwangler   Offline
YaBB Newbies

Posts: 8
*
 
ah yes, thank you so much. exactly what i need Cheesy
 
IP Logged
 
Reply #10 - 12/03/06 at 08:39:22

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
some more info here: http://wiring.org.co/faq.html#060 Smiley
 
IP Logged
 
Page Index Toggle Pages: 1