Shop OBEX P1 Docs P2 Docs Learn Events
more pulse control — Parallax Forums

more pulse control

joe90joe90 Posts: 16
edited 2006-05-25 16:16 in General Discussion

I would like to generate four square pulses. I need help in modulating the pulse height while keeping the frequency the same. Also, I would like to also have offsets as seen in the attachment. (.zip of a .bmp). Any guidance is appreciated.

Comments

  • BeanBean Posts: 8,129
    edited 2006-05-13 00:31
    Do you want to modulate the pulse "height" ? From your picture it looks like you want to modulate the pulse "width".
    Does these need to be continous pulse trains or only so many pulses ?
    What will determine with width of the variable pulses ?
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • joe90joe90 Posts: 16
    edited 2006-05-13 00:37
    I want the left side of pulse to stay put. I want the right side to vary on pulses 3 and 4. No change for pulses 1 and 2. Pulses 1 and 2 need to overlap. Pulses 3 and 4 shouldn't. The pulse height should be the same throughout (TTL logic).

    By the way, I am using SX-key, SX28 for this.
  • joe90joe90 Posts: 16
    edited 2006-05-13 00:42
    this is a continious train. It will vary depending on what is read at the input. It is for a charging application at 15V. If the input is less than 15V then the pulses are increased. If the input is more than 15V then the pulses are decreased.

    To read in the 15V I believe I should program in an anolog to digital converter.
  • BeanBean Posts: 8,129
    edited 2006-05-13 00:43
    If you need continuous pulses then an interrupt is the way to go.
    What are the high and low times for the pulses ? Minimum and maximum for the variable pulses ?
    Will the variable pulse always start at the same offset to the non-variable pulses ? In other words does the frequency of the variable pulses change, or just the duty cycle ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • joe90joe90 Posts: 16
    edited 2006-05-13 15:57
    The high times will vary from 25us to 2us. The low times will vary from·close 25us to 48us for each of the two varying pulses. It is desirable that the two varying pulses (3 and 4) should not simultaneously conduct. Either 3 or 4 should be on.

    Pulses 1 and 2 should have the same off-set with 3 and 4. Basically the varying pulses need to keep their left side in the same place with respect to time. While the right side varies from 25us to 2us.

    Let me know if the time periods I am using are inconvenient. I could increase the time scales a little if that would be better. Changing the times would only affect my plans and would not affect me monetarily.

    Thanks,
  • BeanBean Posts: 8,129
    edited 2006-05-13 18:10
    Okay little by little we are getting there...

    So the variable pulses are always 20KHz with variable duty cycle from 4% to 50%.

    From the picture I will assume that the sets of pulses are offset by 25uSec ? Is this correct ?
    And it appears that wave 1 & 2 are > 50% duty cycle ? If so what duty cycle are they ?

    Joe, you need to supply ALL information you have. This is turning into a tooth-pulling session.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • joe90joe90 Posts: 16
    edited 2006-05-13 22:50
    Yes, you are right about the duty cycle and frequency of 3 and 4.

    Yes, pulse 2 is offset by 25us. Pulses 3 and 4 have an up time of say 30us and a down time of 20us, or 60%. This is arbitrary in my case. It only needs to be >50%.

    This is for a current-fed buck converter feedback loop and will be used to control six transistors.

    Thankyou for your time,
  • joe90joe90 Posts: 16
    edited 2006-05-13 22:50
    sorry,

    Yes, you are right about the duty cycle and frequency of 3 and 4.

    Yes, pulse 2 is offset by 25us. Pulses 1 and 2 have an up time of say 30us and a down time of 20us, or 60%. This is arbitrary in my case. It only needs to be >50%.

    This is for a current-fed buck converter feedback loop and will be used to control six transistors.

    Thankyou for your time,
  • joe90joe90 Posts: 16
    edited 2006-05-18 18:04
    I have written out approximately what I want the chip to do in pseudo code. Any hints in what the commands are in SX-key would be appreciated.
  • BeanBean Posts: 8,129
    edited 2006-05-18 18:41
    Joe,
    Okay, a couple suggestions...

    You will need to devise a way to measure the 15V input. You MIGHT get away with a voltage divider, but you will probably need an analog to digital converter. You could try running the 15V input thru at 100K resistor then to the pin and a 10K resistor to ground. That would make 15V = 1.36 volts (pin detects at about 1.4v).

    There is no way you have have microsecond pulses when operating the SX at 32KHz. Even at 4MHz it will be tricky. I would go with 20MHz.

    You also need to define the actual pin location on the SX chip for example:

    Pin1 VAR RC.0
    Pin2 VAR RC.1
    Pin3 VAR RC.2
    Pin4 VAR RC.3

    I would keep the outputs on one port and the input on a different port. That will make the code easier because you can change all four outputs with one command.

    Did you want to write the code in SX/B ? Or in assembly ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
    ·
  • joe90joe90 Posts: 16
    edited 2006-05-18 19:14
    assembly
  • joe90joe90 Posts: 16
    edited 2006-05-18 20:16
    I notice you used SX/B commands above. if you prefer SX/B or think it will be easier let me know.
  • joe90joe90 Posts: 16
    edited 2006-05-23 00:25
    Bean,

    I would like a few more pointers with my SX/B code.

    I have applied a variable DC source and used the voltage divider as recommended. I expect an increase in the pulse width as I decrease the voltage below 1.36V. I have checked this with an oscilloscope and found this not to be true. I am not able to generate any pulses.

    At the output of the SX28, I have placed an RC network.

    Thank you,
  • DigitalDjDigitalDj Posts: 207
    edited 2006-05-23 02:30
    Joe,

    If you want pulse width modulation you need to get rid of the rc network and go with a current limiting resistor. Otherwise your outputs are just controlling voltage. The capacitor filters the pulse width like it does in a brigde rectifier circuit·and capacitor changing ac to dc.

    Kevin



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Education And Experience Teaches Knowledge Not Arrogance ! (Unknown)
    The Only Stupid Question Is The One Not Asked ! (Unknown, of coarse this is something that i would say)
    Do Not Burn The Bridge That Has Brought You Forth You May·Need To Journey Back ! (Chinese)
  • BeanBean Posts: 8,129
    edited 2006-05-23 11:41
    Joe,

    · I think this is what you wanted.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com


    COMING SOON "SD DATA LOGGER" www.sddatalogger.com

    "I reject your reality, and substitute my own." Mythbusters
  • joe90joe90 Posts: 16
    edited 2006-05-25 16:16
    thanks for your help. works great.
Sign In or Register to comment.