Shop OBEX P1 Docs P2 Docs Learn Events
I am using your Propeller Demo Rev F board — Parallax Forums

I am using your Propeller Demo Rev F board

Pete SrPete Sr Posts: 11
edited 2008-02-21 02:54 in Propeller 1
I am using your Propeller· Demo Rev F board.·
{{output.spin·············· propeller manual pg 104··· Toggles two pins, one after the other.}}·
Pub Main
· Toggle(16, 3_000_000, 20)· ··· 'Toggle P16 ten times,1/4s each····················· no matter what the red number·is the output pulses at 1/2 of that
· Toggle(17, 2_000_000, 20)· ··· 'Toggle P17 twenty times, 1/16 s each··········· contrary to what the manual says. 20 should pulse 20 is the manual wrong?·
Pub Toggle(Pin, Delay, Count)··· {{Toggle Pin, Count times with Delay clock cycles in between.}}
· dira[noparse][[/noparse]pin]~~·················· ··· ··· ··· 'set I/O pin to output direction·
· repeat Count·····························'repeat for Count iterations
··· !outa[noparse][[/noparse]pin]································'toggle I/O Pin
··· waitcnt(delay + cnt)······· ··· ··· 'Wait for Delay cycle
·Pete

Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:48:16 AM GMT

Comments

  • dfletchdfletch Posts: 165
    edited 2008-02-20 17:56
    I think that's because you are *toggling* at 20, not "pulsing". So for that whole 20 clocks, the pin is high and e.g. LED bright, and then "toggle" low and 20 more clocks low/dark. So to pulse at 20, set the numbers to 10.

    Was that a good explanation? I'm pretty new at this smile.gif

    UPDATE: Damn need more coffee obviously, got my # backwards - multiply by 2 of course, not divide, so 40 toggles = 20 pulses.

    Post Edited (dfletch) : 2/20/2008 6:21:44 PM GMT
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-20 18:00
    Look at your program and it tells you what it does.
    There are some misprints and typos in the manual but p. 104 looks o.k.
    Your posting makes no sense at all.
  • Pete SrPete Sr Posts: 11
    edited 2008-02-20 18:07
    No matter what I set the number to The output is 1/2 of that, but the book says it should be the same. If you set it to 10 there should be 10 pulses, If you set it to 20 there should be 20. I get 5 pulses if I set it to 10 and 10 pulses if set to 20 and so on.
  • ClemensClemens Posts: 236
    edited 2008-02-20 18:15
    toggling the output means "changing the state" of the output, so "on/off/on/off/on/off/on/off/on/off/on/off/on/off/on/off/on/off/on/off/" is 20 toggles is 10 pulses !
  • dfletchdfletch Posts: 165
    edited 2008-02-20 18:16
    Toggling and pulsing are not the same thing! Toggling is basically doing a bitwise NOT operation on the pin, changing it's state. So if it was high, it will become low and vice-versa. This is *half* a pulse, not a full pulse.
  • dfletchdfletch Posts: 165
    edited 2008-02-20 18:17
    Ahh Clemens beat me to it smile.gif
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-02-20 18:17
    Pete Sr said...
    If you set it to 10 there should be 10 pulses...

    Not true. "Toggle" means switch to low if the output is high, and switch to high if the output is low. One "pulse" = two "toggles".

    -Phil

    Update: Well, I guess I was last in line for this one!
  • Pete SrPete Sr Posts: 11
    edited 2008-02-20 18:19
    Got it. Read the manual again and either was really tired or was locked in on my thinking of what I wanted to see.

    Thanks
  • DgswanerDgswaner Posts: 795
    edited 2008-02-20 22:45
    ok this made me laugh so hard I couldn't resist.... (the video) and I can't find a better video of just that scene...

    www.youtube.com/watch?v=HMlEiTigsiI jump to the 5:00 minute mark, near the end. Where they talk about toggles.... then read the above posts again..... quite similar!

    sorry guys I couldn't resist. I think mystery men is one of the most under rated movie of all time.

    "I don't think he's going to pull through!"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster

    DGSwaner
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-20 22:59
    Being a foreigner myself, I am tremendiously interested in things like this..
    Webster's said...

    Toggle vt. To change a bit from whatever state it is in to the other state; to change from 1 to 0 or from 0 to 1. This comes from `toggle switches', such as standard light switches, though the word `toggle' actually refers to the mechanism that keeps the switch in the position to which it is flipped rather than to the fact that the switch has two positions. There are four things you can do to a bit: set it (force it to be 1), clear (or zero) it, leave it alone, or toggle it. (Mathematically, one would say that there are four distinct boolean-valued functions of one boolean argument, but saying that is much less fun than talking about toggling bits.).

    Interestingly Webster's categorizes this usage as "jargon"
  • ClemensClemens Posts: 236
    edited 2008-02-21 00:09
    Spooky: On german Wikipedia it says the movie "Mystery Men" cost 68 Million USD and only made 33 Million...
    Do you get it? 68 is 33 plus one additional Toggle...

    Coincidence?

    Never heard of that movie before I don't think they played that one in Berlin. - What a shame.
  • dfletchdfletch Posts: 165
    edited 2008-02-21 00:22
    Clemens: Oooh YES! I'm one step closer to having a finite Erdős–Bacon number! en.wikipedia.org/wiki/Erd%C5%91s-Bacon_number Ok maybe not, but a fellow can dream, can't he!?
  • deSilvadeSilva Posts: 2,967
    edited 2008-02-21 02:42
    Can't believe this.... That happens quite often to me in the last few years.. advanced age?
  • simonlsimonl Posts: 866
    edited 2008-02-21 02:54
    @Clemens: That'd be TWO toggles wouldn't it?! freaked.giftongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
Sign In or Register to comment.