Exact match. Not showing close matches.
PICList
Thread
'[SX] Reading the SX48 Timers ?'
2006\02\09@074202
by
beann/a
|
|
This is my first program using the on-board 16 bit timers on the SX48.
I can read RTCC at any time, but it seems the timers must have some external event to "capture" the count in the timer.
Am I missing something or is it just not possible to read the timers on the SX48 ?
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\09@082405 by Coriolisn/a
|
|
It appears you are correct that the timer count cannot be directly accessed. How about combining the 16 bit timer to clock the external 30 kHz clock (using the compare mode), and extending the RTCC to 17 bits (16 bits plus overflow bit). That way you have access to the number of processor cycles that have occured during the 1000 external cycles.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108744
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\09@085151 by Peter Van der Zeen/a
|
|
Hi Bean;
Yeah, that's one of the "not so nice" things abaout the SX48/52.
Also the (forced) requirement of alternating a timer's two "compare" registers is another "feature", and is not well described in the Ubicom docs. It can really throw you for a loop.
Cheers,
Peter (pjv)
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108750
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
|
|
Okay thanks guys, I thought I was missing something there.
I found that in Capture/Compare Mode I can just toggle the "capture" pin then read the capture register. No big deal.
But that doesn't work in External Event Mode. How do I get the count of external events ? Pulsing the capture pin doesn't work.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108757
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\09@104203 by Coriolisn/a
|
|
The capture mode is meant to capture the time duration of a single event hence the need to , whereas the external event is meant to capture the counts of multiple events. An alternative to the method I described above is using both 16 bit timers, the first is set to external event mode, setting up the the span of r1 and r2 to be 1000 cycles. The output of the external even timer is used as the input to the second timer which is configured in the capture/compare mode, in which you retrieve the capture register. I may not have to precise methodology correct, but the combination of the two timers configured as such should accomplish what you are after.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108762
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
|
|
Paul,
Thanks, I got it working. In case your wondering it basically a reciprocal frequency counter.
Setup counter 1 for capture/compare mode.
Setup counter 2 for external event mode. Set R1 of counter 2 to 1000 (or whatever value). Set counter 2 to generate an interrupt when it reaches R1.
In the interrupt routine pulse counter 1 capture pin. Read the count captured from counter 1 capture register.
Works like a charm.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108766
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\09@114046 by Coriolisn/a
|
|
Glad to hear it worked, at lunch I remembered using cascaded multi-purpose timers in college for IR packet transmission, but we used the two timers on the MC68HC11 in reverse, the first in capture mode to get the IR pulse widths, and the second in external event mode to count the number of bits in the packet.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108769
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
|
|
I've not played around with the timers until now. So they have been somewhat of a mystery. But man they really made this task much easier.
I've something simalar with the SX28 and it was ugly and required 100% of the CPU time while measuring.
Now I'll have to try to think of some other uses for them so I can learn more about them.
Bean.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108837
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
|
|
The PWM mode is great for a set-it-and-forget-it DAC, and since its 16 bit you can achieve pretty good resolution.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m108841
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\12@073452 by George Herzogn/a
|
|
Can anyone suggest some reading material for a novice to try to get up to speed on this. Something that is relatively introductory and overview.
I just cannot seem to grasp the 'Capture and Compare' concept.
It wouldn't hurt to actually have examples [Guenther's book stays with the SX-28 for examples - so this is really uncharted].
Thanks....
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m109081
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\13@102744 by Coriolisn/a
|
|
The new parallax documents do a better job explaining them: http://www.parallax.com/dl/docs/prod/datast/SX48BD-Data-v1.01.pdf#page=32
the Capture and Compare are actually two different functions in the same mode and are abbreviated for Input Capture and Output Compare.
The input compare function upon detecting a transition on the input compare pin for that timer, copies the current value of the free running timer into a register, you can think of this as a timestamp. This is much like the function of the Port B interrupts but with the timer value thrown in. Obtaining two time stamps you can determine the time between two different events (if the transistion edge the input compare activates on is the same) or the duration of a single event (if the transition edge the input compare activates on is changed).
The output compare mode is much like the PWM mode except the timer does not reset when the value R2 is reached. This is equivilent to a fixed period PWM (base time is fixed according to 2[sup]16[/sup] timer cycles). I am a little unclear of the real world behavior of output compare mode for the SX, whether the contents of R2 dictate the second toggling of the output pin, or if the timer overflow causes the toggling of the bit (or if you have to manually toggle the bit during a timer overflow interrupt). But this behaviour could be easily verified by using a close value of R1 and R2 and using a large prescaler for the timer and an LED connected to the output compare pin for the timer.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m109215
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
2006\02\14@000653 by George Herzogn/a
|
|
Thanks Paul. I suspected that, but every manufacturer [except for intuitive Parallax] out there seems to call it a Capture/Compare Unit.
I read Guenther's presentation and it seems that Capture is dependent on one pin per timer. One cannot assign other pins.
I really have to work around this limitation ---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=108735#m109347
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2006
, 2007 only
- Today
- New search...