Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Measuring transfer time

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
bibibo

Bascom Member



Joined: 30 Nov 2009
Posts: 168

slovakia.gif
PostPosted: Fri Sep 12, 2014 6:17 pm    Post subject: Measuring transfer time Reply with quote

Hello, i would like to do a device for measuring transfer time in an UPS applications. UPS topology offline and line-interactive has transfer time line-battery and battery-line around 4 - 10ms. I am not sure if MCU atmega is good choice for this measuring. What do you think ?
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2472
Location: Queensland

australia.gif
PostPosted: Wed Dec 10, 2014 10:51 pm    Post subject: Reply with quote

Any AVR is well capable of measuring times in that range.

Just use a timer. Set the prescaler so that the timer does not overflow for the longest interval you want to measure, depends on the processor clock speed.

Read the timer at the start of the interval, eg when a processor line goes high ( or low ). Read the timer at the end of the interval.

Subtract the two, and that is the time interval in timer clock cycles. Then since you know the timer prescaler value, and the processor clock speed, you can work out exactly how long that interval is.

As long as you do the subtraction in bytes ( for an 8 bit timer ) or words ( for a 16 bit timer ), timer rollover during the measurement will not affect the result.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum