Shop OBEX P1 Docs P2 Docs Learn Events
SX48 Timers question — Parallax Forums

SX48 Timers question

LoopyBytelooseLoopyByteloose Posts: 12,537
edited 2010-08-05 11:20 in General Discussion
This may seem a bit idiotic, but Gunther's book never goes into the SX48 and SX52. I have several of each.

Are the hardware timers in parallel with the processor operation? And if so, how do you monitor the results?
In some cases, like PWM generation, it would seem there is no need to monitor. But in others, like maybe a second longer form of ISR, it appears one must do so.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?

aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

Comments

  • David BDavid B Posts: 591
    edited 2010-07-31 16:36
    The manual says "It is clocked by either an external signal provided on an I/O pin or by the on-chip system clock divided by a 3-bit divide-by factor." But I've never used the timers myself; I've been reading the manual but don't know enough to say much about actually using them in terms of getting results.

    I just bought 10 of the SX48 boards, and was starting to think about using one for something I've needed for several projects lately - a propeller RAM accessory board that uses as few pins as an SD card, can write to RAM faster than an SD card, like a long per microsecond or faster, and has a capacity of well into the tens of megabytes. I'm thinking that an SX48 card driving a surplus 30 or 72 pin SIMM DRAM may be able to do this.

    So I also started looking at the SX48 timers to see if they'd be useful for fast serial clocking of 32 bit longs.

    The Parallax SX48BD manual chapter on them looks pretty good, but as with anything like this, some actual examples would be really helpful.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-07-31 17:00
    Excellent investment - I just bought 3 and I saw I had 5 SX52s that never have been used.

    Okay, here is a project concept to consider.

    I have a Parallax Toddler that used to have a BasicStamp2 running it, but at some point all the added gizmos are too much for the PWM to the motors. With an SX48, it would appear that I have to 16bit PWM generators available that would free up processing to do other tasks. And of course, I have more program memory as well.

    I see that SX/B is finally coming out with Version 2.0, so I might try that. I happened to already drill a couple of holes in an SX52 Proto Board and mount it ion the Toddler. Originally I was considering having a BasicStamp drive the motion and the SX52 driving everything else. But this seems far more elegant as PWM would hold position between command changes without two processors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2010-08-02 00:30
    The SX48 has two 16-bit timers. Those work well for generating PWM. I've used them to directly drive continuous rotation servos and the hardware timers can do that in the background. I've also use them to control a standard motor w/h-bridge. An example is shown in this thread:

    http://forums.parallax.com/forums/default.aspx?f=7&m=357764&g=358805#m358805

    When using the timers I had to mask off the interrupts so that the timers won't generate any in PWM mode. Otherwise it was messing up the ISR based Serial code.

    Robert
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-02 10:20
    Thanks ever so much.

    The SX48 documentation is a bit rough going to understand. I've been over it many times and it certainly seemed to be possible that it would mess with ISRs.

    In fact, it does look like one of the Timers could be used as an alternate ISR timer if you had more than 255 words of code to work through. But I don't quite know why one would bother. And of course, having two different timer interrupt intervals makes everything indeterminate - the opposite of why the ISR is so useful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 8/3/2010 8:47:14 AM GMT
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2010-08-02 14:53
    As long as you know all of the sources that are going to generate Interrupts then you can craft the ISR to handle them. In my case I was using the timers as fire and forget and didn't need to follow their status. So, I just masked off their Interrupts to keep the code in the ISR simple and just use it for receiving serial data.

    Robert
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2010-08-04 22:56
    > This may seem a bit idiotic, but Gunther's book never goes into the SX48 and SX52. <

    George,

    please check pages 237 ff in my book for a description of the SX 48/52 timers. You will also find more information about the SX 48/52 in other chapters of my book. The TOC should direct you to the right spots smile.gif.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-08-05 11:20
    Guenther, you are right. I have been reviewing the PWM code for the SX28 and I do indeed see that you document the timers. If fact, I was pondering whether to retract that comment. And it is as good an introduction as the the original PDF (and in a more convenient reference).

    But what I really meant was you don't provide any code examples of actual use. I apologize for presenting an untruth.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
Sign In or Register to comment.