The Godfather talking
You can run, but you can't hide.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 04:23:19 16:23


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 1007 times)
0 Members and 1 Guest are viewing this topic.
oladiladio
Newbie
*
Offline Offline

Posts: 21

Thank You
-Given: 61
-Receive: 72


One size does not fit all.


« on: June 22, 2015, 12:24:17 12: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: 43

Thank You
-Given: 14
-Receive: 8



« Reply #1 on: June 22, 2015, 01:33:40 13: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: 115

Thank You
-Given: 151
-Receive: 1262



« Reply #2 on: June 22, 2015, 01:57:10 13: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: 43

Thank You
-Given: 14
-Receive: 8



« Reply #3 on: June 24, 2015, 02:35:30 14: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