Shop OBEX P1 Docs P2 Docs Learn Events
Question re BS2.PWM_Set (Pin,duty,resolution) — Parallax Forums

Question re BS2.PWM_Set (Pin,duty,resolution)

OzStampOzStamp Posts: 377
edited 2007-11-28 09:53 in Propeller 1
Hi

Having a play with all the functions Martin Hebel has created..
WOOW Martin awesome the latest BS2.Functions is fantastic thanks..

Using the BS2.PWM_Set ( 8,512,10) example.. to a led on pin 8..
I can see my LED dim and go brigther as I set the duty higher and lower
so obviously the pin is doing what is suppose to be doing..
But for some reason I can't get a steady signal on my scope
What is the PWM frequency ? ·and is it very jittery...??

Cannot ·get my scope to trigger on it at all..

Has anybody used this function and shine some lite on it..

Love that Freqout call set it 100000 and she spits out 100000KHZ signal awesome..

cheers
Ron· Melbourne OZ..





Post Edited (OzStamp) : 11/27/2007 9:31:38 PM GMT

Comments

  • LeonLeon Posts: 7,620
    edited 2007-11-27 09:06
    You probably won't be able to see a PWM signal very well on a scope unless you slow it right down.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-11-27 14:37
    Hi Ron,

    Much like the BS2, the output won't be an idealistic PWM shape.· The counter mode and the overflow timing creates the necessary high vs low time to achieve the duty desired.

    Thanks for the compliment, it's helped me learn Spin and counters and it's worked out well as examples in the classroom.·Much of it was adapted from other sources, such as Andy's various work.

    Though sometimes I look though it and think about how I could improve it more having learned a lot since my beta tester days with Spin and the Prop.

    -Martin



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    SelmaWare Solutions - StampPlot GUI for controllers, XBee and Propeller Application Boards

    Southern Illinois University Carbondale, Electronic Systems Technologies
  • OzStampOzStamp Posts: 377
    edited 2007-11-28 09:53
    Hi Martin..

    Yes same here.. still learning alot .. just not enough hours in the day..
    Spend a few hours lately just going some thru the BS2 functions and reading alot..

    We inherited a job from somebody and was asked to finish it ..
    The code would work fine for 10 minutes or so ·but eventually it would crash
    the Prop.. rebooting would alway's fix it..

    I fell for the "ABORT"abort trap.. the syntax ABORT ( scan) would work·..
    You could see the code jump to the PUB called·scan and run whatever was there...

    Anyway I got frustated with it and asked for help.
    Peter Jakacki here locally got me out of the POO...thnx Peter ..
    We finished it off using the same BULLDOZER approach as he called it
    but we got something that is now running solid..

    We initially suspected faulty PSU·· ... faulty chip etc etc.
    In the end it only could be the program...

    We need to add some more functionality to it ..
    Jeff Martins encoder object .. looks like it could be usefull for what we need.
    I played with that object before and found that the READ Delta variable
    seems to·act a little strange.. with an encoder standing still ( one of those volume indent panel mount
    type ones .. used for volume controls..) it would still return a deviation of -1 or even +2..

    Credit again to you.. also to Mr Voss I see his name mentioned thru out the
    BS2.fucntions and of course also Andy Lindsay..

    Cheers

    Ron Melbourne OZ
Sign In or Register to comment.