Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp to generate pwm to control temperature — Parallax Forums

basic stamp to generate pwm to control temperature

0001T0001T Posts: 14
edited 2007-05-18 15:42 in Learn with BlocklyProp
Hello...i chanced upon this forum searching for information on pulse width modulationblush.gif

I am doing a school project whereby I need to control the temperature of a heating element such that it will not overheat. I was told to use pwm to control the output current to 0.8A [noparse][[/noparse]electical resistive heating]·for a period of time.

I have access to a basic stamp 2 but the fact is·I do not know how to use it. Is there anyone or any data sheet/ manuals that I can refer to?

Thank you.

Comments

  • Mr. RichardMr. Richard Posts: 51
    edited 2007-03-19 09:33
    The best place to start would be a book published by Parallax. The book is a great way to get started in microprocessor control. It can be downloaded for free here

    http://www.parallax.com/detail.asp?product_id=27207

    look at the bottom of the page for the link "What's a Microcontroller v2.2 (.pdf)"

    after that keep asking questions here

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Magic Smoke Theory of Electronics –
    Inside every electronic part there is magic smoke.
    The magic smoke is what makes everything work.
    If you release the magic smoke, the part stops working!
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-03-19 12:40
    You may want to also check out the "Process Control" text from Parallax since nearly 1/2 the text deals with temperature control.
    http://www.parallax.com/detail.asp?product_id=122-28176

    -Martin (Author)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • 0001T0001T Posts: 14
    edited 2007-05-18 06:21
    finally, i have got hold of the bs2 & now learning to do the programming.

    instead of using the pwm function, i chose to use pulsout...this is the simple program which i've got...

    counter VAR Word

    DO
    DEBUG ? IN3

    IF IN3 = 1 THEN

    FOR counter = 1 TO 5
    PULSOUT 0, 50000
    PAUSE 1000
    NEXT

    PULSOUT 1, 10000

    FOR counter = 1 TO 5
    PULSOUT 0, 50000
    PAUSE 2000
    NEXT

    PULSOUT 1, 10000

    ENDIF
    LOOP


    however, i realised that each time i press the pushbutton [noparse][[/noparse]normally open type] connected to IN3, the program must complete one cycle. how do i go about modifying the program such that the moment i release the pushbutton, the program would stop?

    thanks
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-05-18 11:47
    0001T -

    Presently the DO ... LOOP combination is causing your program to run indefinitely. If you want just one iteration, then remove both commands. If you want it to continue for some finite period, you may want to use LOOP with the UNTIL option:

    LOOP UNTIL counter = 10 or somethng like that.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-05-18 15:42
    Hi, EXIT will allow you to exit a loop, just look for the release of the button.If the condition is true exit the loop and wait for the next button press.

    main:
    Timer=1000··· 'initialize pause time
    DO WHILE IN3<1··· 'wait for button press
    LOOP

    DO WHILE Counter<10····· 'loop 10 times
    Counter=Counter+1
    IF Counter=6 THEN Timer=2000···· 'on count 6 make pause 2000
    PAUSE Timer
    IF IN3=0 THEN EXIT·· 'exit on button release
    PULSOUT 0, 50000
    LOOP

    Counter=0···· 'initialize Counter

    GOTO main······ 'go do it again

    If the pulsout assigned to pin·1 is for indication that the heater is on then add these two lines either side of the pulsout 0 line.

    HIGH 1
    PULSOUT 0, 50000
    LOW 1

    Jeff T.
Sign In or Register to comment.