Shop OBEX P1 Docs P2 Docs Learn Events
Two puzzling problems.. — Parallax Forums

Two puzzling problems..

lardomlardom Posts: 1,659
edited 2012-11-06 08:27 in Propeller 1
The first puzzle is why did I have to use cognew to set up PWM with the counters. (The examples I've seen used repeat loops.) If that is normal then OK.
The second puzzle is the transistor I used in the circuit drew current even though the Propeller Demo board was switched off!
When the prop was grounded to the emitter and the i/o pin was connected to the npn base I could measure voltage between the emitter and the collector.
Just to test I used a Quickstart board to see if there was resistance between an i/o pin and ground. I measured around 12.6 megohms. I got a resistance measurement for both boards.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-11-03 14:39
    Regarding the transistor, how about a diagram? What else was the Demo Board connected to? There are all sorts of ways for power to leak into and around any CMOS device like the Propeller through substrate diodes and other structures when the device is supposedly off. Power can come in via the USB interface if that's powered for example.
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-11-03 15:21
    With a single counter you can't generate a PWM! A counter running alone will only give a signal that has a 50:50 pulse pause ratio. You can increase the frequency and make both, pulse and pause, shorter. But a PWM has a variable pulse pause ratio.
    That's why the COG is needed to reset the counter periodically (according to the PWM frequency)!

    There is a trick available which uses 2 counters to generate a PWM and then you don't need the COG to maintain the PWM frequency.

    If you want more pins that output a PWM it's simply more practical to start a PWM object which generates the PWMs old-style.
  • lardomlardom Posts: 1,659
    edited 2012-11-03 16:42
    @Mike Green, Sorry about the lack of a diagram. I'm using a hot spot. I'll copy the essential info onto a flashdrive and repost at my next opportunity.
    @MagIO2, I'll take your advice. I'm trying to create a pwm power supply which can be controlled by a potentiometer for a brushless motor. I've gotten satisfactory speed with DC and a step pattern but learning to control the supply voltage is harder than I thought.
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-11-04 03:21
    I tried to find the thread where the 2 counter method has been introduced ( I think it's been described by Beau ). Maybe someone has a direct link to the thread to share it here?

    The basic idea is easy: Have 2 counters -connected to 2 pins- which have the same frequency but are out of phase. With an external xor the phase-shift generates a PWM. The trick mentioned in the thread avoids the external xor somehow - but I don't remember.
  • kuronekokuroneko Posts: 3,623
    edited 2012-11-04 03:30
    @MagIO2: Try this one and related links.
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-11-04 04:57
    Thank you kuroneko! I should start to manage favourites, as finding old threads seems to be hard sometimes!
  • lardomlardom Posts: 1,659
    edited 2012-11-04 14:35
    @MagIO2, Thank you.:cool:
    @kuroneko,:thumb: 'The riddler'? You've helped to solve a few of mine. Thanks for the link.

    The way I connected the transistor was to connect the battery negative to the emitter, the collector to the breadboard ground rail and the battery positive to the breadboard positive power rail. I attached the i/o pin to the npn base through a resistor and grounded the Prop to the emitter. It made sense to me. On the same breadboard I built a 3 1/2 H-bridge that worked perfectly. I'm still searching for my error.


    Transistor for PWM.JPG
    713 x 425 - 36K
  • lardomlardom Posts: 1,659
    edited 2012-11-06 08:27
    My wife yelled "Larry!!" and I wanted to jump out of my seat imagining some critter was about to pounce on me... I turned my head expecting danger and she exclaimed "The TV's back on!" My second thought was that I could communicate with the world again.
    Searching for solutions to my current project has been tough because of hurricane Sandy. Realizing now that I could have initialized the counters with OBJ instead of using the cognew command...I wish I had not asked.
    This is a great forum. I always end up with a net gain in knowledge beyond my original questions so thanks for not brushing my questions aside.
Sign In or Register to comment.