Shop OBEX P1 Docs P2 Docs Learn Events
Conflict between SerIn and Pulseout? — Parallax Forums

Conflict between SerIn and Pulseout?

huynhhuynh Posts: 16
edited 2009-03-05 06:45 in BASIC Stamp
Dear all members in this forum,

I joint in this forum today. I am dealing with a problem of control DC motor and servo by using Micro controler and PWM.

I am using BX24 to receive data and generate PWM corresponding to the data. Unfortunately, I got the conflict in doing two task at the same time.

I found that it is easer to solve this problem by using BSstamp. Currently, I can have BS2p40 and other acessories as L293 and 74HCT14.

I can built a circuit as in site http://members.tripod.com/~ArtooDetoo/schemx.html.

I intend to use SerIn to receive data and PulseOut to generate of PWM. I wonder that whether there is a conflict in BS2p40 as in BX24 or not.

It's my honor to have your suggestion.

Thank you in advance.

Pthien,

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-03-04 13:37
    Pthien,

    There should be no difficulty in using Serin and PWM on the same Stamp. However, you must be aware that the Stamp is like most other micro controllers in that it can only be doing one task at a time.

    In your case, your program must successfully read the serial data, then calculate the proper PWM value and finally issue the PWM command. Then repeat.

    See the Helpfile on SERIN for more explanation on how to use command.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Craig EidCraig Eid Posts: 106
    edited 2009-03-04 19:58
    Pthien,



    The PWM function on the Stamp·does not operate like a typical PWM generator. The Stamp implementation combines a series of very short duration 1's and 0's to generate the signal and is designed to work with an external RC filter to generate a DC voltage that is proportional to the [noparse][[/noparse]DUTY] variable of the PWM function. ·

    An off the shelf PWM motor controller would be a simpler implementation – see the attached link for the datasheet on the TI UC3638 -http://focus.ti.com/docs/prod/folders/print/uc3638.html#features .

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Craig Eid

    www.TriadRD.com
  • huynhhuynh Posts: 16
    edited 2009-03-05 04:10
    Hi Tom Sick and Craig Eid,

    I am trying to use BS2p40 to generate PWM with the PulseOut function rather that the PWM function. Hope that Pulseout of Basic Stamp has the same characteristic as in B24. Because currently I can use Pulseout of BX24 to generate PWM.

    Thank two guys for your suggestions.

    Pthien,
  • Craig EidCraig Eid Posts: 106
    edited 2009-03-05 06:45
    Pthien,

    A BS2p40 can accurately generate a HIGH or LOW pulse for a defined duration using the PULSOUT function but you need to carefully evaluate·the timing for the remainder of the code that you have written. As Tom mentioned, a Stamp can do only·one task at a time and some functions take more time than others - see Tracy Allen's·writeup on Stamp interpreter execution timing - http://www.emesystems.com/BS2speed.htm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Craig Eid

    www.TriadRD.com
Sign In or Register to comment.