Shop OBEX P1 Docs P2 Docs Learn Events
How does PWMPal work — Parallax Forums

How does PWMPal work

jbalatjbalat Posts: 96
edited 2009-07-30 23:59 in BASIC Stamp
I need to be able to change the frequency all the time. Sometimes I am getting 2 lows, 2 highs stuck together

What happens when you send a new command to the PWM PAL, does it just stop everything and start with the new wave or does it complete the old one first ?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-26 15:07
    I think it just stops and reinitializes the channel you've selected. I believe it continues what it's doing with the other (unselected) channels.
  • jbalatjbalat Posts: 96
    edited 2009-07-28 00:02
    Yeh... The PWMPal is definitely re-triggering upon the new command without completing the old one..

    Is it possible to contact the designer and ask if there is a workaround ?

    I have tried reading the pwmpal output pin with IN12 command and looping until high, then looping again until low, and then issuing the next command, however either the bs2 is too slow or the pwmpal takes a little too long to respond once the new command is issued.

    Having said that the wave produced is a lot better than it was during ramping...
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-28 00:20
    You might look at the BS2pe Motherboard which includes two AVR co-processors whose code is open source. The communications protocol is Dallas' 1-Wire which the older Stamp models (than the BS2p) don't support. One of the co-processor functions is producing PWM for servo control and you could modify that to do whatever you need. You could even modify the AVR program to use a protocol that the BS2 could support like SPI. I believe the main reason for choosing the 1-Wire protocol is to save on I/O pins.
  • jbalatjbalat Posts: 96
    edited 2009-07-29 02:05
    Mike assuming my board may work as it is,
    I get a problem when I cut the ecu wire to the sensor since the supply voltage from the ecu to the sensor and input signal from the sensor to the ecu are using the same wire.. When I insert my stamp inbetween the ecu and sensor the input signal dies and my board just locks up, needless to say the engine dies also.

    If you get a chance can you pls have a quick look ?
    www.fuel-saver.org/Thread-ECU-behaviour?pid=29476#pid29476
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-29 02:57
    Please post a schematic and a listing of your program (as attachments to a message ... not cut and pasted).
  • jbalatjbalat Posts: 96
    edited 2009-07-29 11:53
    Sorry Mike,
    I have uploaded all the relevant information to my project.

    Not sure but we think we have a way forward now connecting the stamp inbetween the MAF and the ECU (see pic stampinstall.jpg).

    As I mentioned the code has been stripped down to try and eliminate re-triggering issues from the pwmpal as the frequency changes. If you can think of a better way then pls let me know

    Thanks again
    JB
    640 x 248 - 84K
    640 x 340 - 124K
    582 x 489 - 41K
    898 x 505 - 78K
  • jbalatjbalat Posts: 96
    edited 2009-07-30 23:59
    Mike or anyone, can you please have a quick look at my bs2 code (MAF_Rev3_beta4_bs2.txt)

    It is still causing an erratic frequency output due to the pwmpal re-triggering at the wrong time. Just need to get the timing right and it should work

    My board is now in the car and no engine warning light. The car jumps around now and then as I drive. This is likely because of the re-triggering issue....

    Any help appreciated

    Thanks,
    JB
Sign In or Register to comment.