Interrupts time | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Interrupts time
August 1, 2016
9:51 pm
Avatar
miche91
Member
Members
Forum Posts: 35
Member Since:
May 11, 2016
sp_UserOfflineSmall Offline

Hi everyone,

Can someone tell me what is the best way to determinate the time elapse between two digital interrupt.

For an easy example what can I do for print on serial, when an interrupt happens, how many times is elapsed from the previous interrupt?

 

thanks

Michele

August 2, 2016
1:23 am
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

You can use the Tick Count Micros VI to get the elapsed time each time your interrupt goes off.  Keep in mind the tick counter does not increment while your interrupt is running, but this should be quick.

August 2, 2016
5:51 pm
Avatar
miche91
Member
Members
Forum Posts: 35
Member Since:
May 11, 2016
sp_UserOfflineSmall Offline

Thanks Steffan,

I already use this way and this work perfectly, I've use the tick count inside the Callback VI but I would like to have the relative time between two interrupts! Using only Tick Count Micros VI, I only have the absolute time from the power on of arduino board.

I think I have to use a variable that stores Tick Count Micros value and, when the netx interrupt goes on, my VI could make the difference between the two values of Tick Count.

What do you think about this way?

thanks

August 2, 2016
6:46 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

That's correct you have to calculate the difference by storing the last value and subtracting from the current value. 

August 2, 2016
8:18 pm
Avatar
miche91
Member
Members
Forum Posts: 35
Member Since:
May 11, 2016
sp_UserOfflineSmall Offline

yes,

But i don't know how to overwrite the variable after subtraction was calculate.

Shall I use local variable?

August 4, 2016
8:10 am
Avatar
filipealtoe
Admin
Forum Posts: 98
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

These questions are related to LabVIEW itself and not to the Compatible Compiler for LabVIEW. You may be better served posting them on a LabVIEW beginners forum.

 

Filipe 

Cheers
Filipe

August 7, 2016
9:15 pm
Avatar
miche91
Member
Members
Forum Posts: 35
Member Since:
May 11, 2016
sp_UserOfflineSmall Offline

I found the way to do this VI and it works perfectly, now, every time that an interrupt occours, I have on serial port the number of micros from this interrupt and the previous one!

Now i would like to store this values in a embedded sistem, I've tried to store on SD card by using SD_datalogger.VI but it doesn't work, can you take a look on my interrupt callback VI?

maybe SD_datalogger.VI is too slow?Immagine.pngImage Enlarger

thanks

sp_PlupAttachments Attachments
August 9, 2016
9:12 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

You cannot write SD card in an ISR.  In general, your ISR should be very quick and should not do any heavy lifting.  Refer here:

http://forum.arduino.cc/index......ic=66450.0

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
17
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356