Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2024, 09:34:36 09:34


Login with username, password and session length


Pages: [1]
Print
Author Topic: millis() and/or micros() in MikroBasic Pro 6.1.0 for AVR  (Read 8190 times)
0 Members and 1 Guest are viewing this topic.
oladiladio
Newbie
*
Offline Offline

Posts: 29

Thank You
-Given: 127
-Receive: 80


One size does not fit all.


« on: June 22, 2015, 11:24:17 11:24 »

I would like to use these (Arduino)functions in Basic programs.

Who can point my nose in the right direction?

Thanks in advance!
Logged

Stupidity has a certain charm, ignorance does not - Frank Zappa
Elmer
Junior Member
**
Offline Offline

Posts: 41

Thank You
-Given: 13
-Receive: 11



« Reply #1 on: June 22, 2015, 12:33:40 12:33 »

I've never touched Basic languages on MCUs, but if like in C they can use inline assembler, I'd simply count cycles and use use an inner/outter loop setup containing dummy "nop" instructions. Or if you have access to timers, you can use those, basic comparison with overflow check.
Logged

peace in the valley
Xwing
Active Member
***
Offline Offline

Posts: 210

Thank You
-Given: 588
-Receive: 1530



« Reply #2 on: June 22, 2015, 12:57:10 12:57 »

Arduino millis and micros functions are handled through ATmega328  timer0 and relative interrupt.
In Mikroelektronika compilers there is nothing equivalent.
Logged
Elmer
Junior Member
**
Offline Offline

Posts: 41

Thank You
-Given: 13
-Receive: 11



« Reply #3 on: June 24, 2015, 01:35:30 13:35 »

If no better methods are available, you could still use a loop in Basic, and toggle an IO on start and end, time it with your scope and tune in the number of loops. Should AFAIK be fairly consistent given that the MCU speed, compiler version and code optimization level stays the same. Hardly a pretty solution though... FWIW, if you don't even have access to timers, I'd frankly move on to C...
Logged

peace in the valley
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC