generating square wave


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2012
    Posts
    6

    Default generating square wave

    i am a beginner in this world of programming i want to switch the transistor in dc dc converter. for my knowledge the transistor can be switched by square wave, i need the sample code here on how to switch this transistor. anyone to help me please

  2. #2
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    Quote Originally Posted by boscox View Post
    i am a beginner in this world of programming i want to switch the transistor in dc dc converter. for my knowledge the transistor can be switched by square wave, i need the sample code here on how to switch this transistor. anyone to help me please
    A square wave is simply turning it on and off. It goes from low to high and repeats.

    For example:

    Code:
    DO
          PORTA.0 = 1 'TURN ON PORTA.0
          PAUSE 50 'PAUSE 50mSEC
          PORTA.0 = 0 'TURN OFF PORTA.0
          PAUSE 50
    LOOP
    This endless loop will turn the pin on and off with a 50msec delay. You could also use the TOGGLE command.

    Hope this helps!

  3. #3
    Join Date
    Apr 2012
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    Quote Originally Posted by andywpg View Post
    A square wave is simply turning it on and off. It goes from low to high and repeats.

    For example:

    Code:
    DO
          PORTA.0 = 1 'TURN ON PORTA.0
          PAUSE 50 'PAUSE 50mSEC
          PORTA.0 = 0 'TURN OFF PORTA.0
          PAUSE 50
    LOOP
    This endless loop will turn the pin on and off with a 50msec delay. You could also use the TOGGLE command.

    Hope this helps!
    thanx for your suggestions but let me to make this clear,
    i want to vary the time of switching on and off of the transitor ( to vary the duty cycle ),

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    Search the picbasic manual and the forum for "PWM" and "HPWM"

  5. #5
    Join Date
    Apr 2012
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    Quote Originally Posted by mark_s View Post
    Search the picbasic manual and the forum for "PWM" and "HPWM"
    i read those manual you mentioned to me but i didn't seen any way to do with that so as to come up with the code

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,613


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    Top right of the page, Advanced Search, type in HPWM and Enter.

    I get 6 pages of threads about HPWM. I find it hard to believe there isn't one good example in all that.

    And yes, that is how many of us find examples on how to do stuff. I know it takes a long time, it's tedious, but sorry, that's life.

    You also get to pick up interesting tidbits about HPWM on the way through.

    Robert


    EDIT: If you do encounter problems getting some of the code to work, feel free to post it here along with your question and people will be happy to help you figure it out.

    But people will not do all the work for you without you first putting in some effort.
    Last edited by Demon; - 20th April 2012 at 18:34.

  7. #7
    Join Date
    Apr 2012
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: generating square wave

    i got you demon and thanx for your help, i will come back to you if i feel any difficulties

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts