How to genearate a pulse with Variable ON-Time and OFF-Time using 8253(4) ?

Dear All,

I need to generate a pulse trains which on-time and off-time can be adjusted by user individually.

Pls help to provides your valuable advise. Thanks. regards, lamb (I like lamb)

Reply to
lamb
Loading thread data ...

A better description would be helpful. What you've described leaves open far too many possibilities for a meaningful reply.

Jon

Reply to
Jonathan Kirwan

The 8254 is not the best chip for that job. The 9513 chip can do what you ask. If you must use the 8254 to do this job, then you will really be using the processor to generate the pulse train and the 8254 will just be used by the processor to keep time. The processor will have to be actively involved with every edge. The 9513, on the other hand, has two registers that can be set up to alternately load two different presets that are counted down. Once it is set up, the processor can go away and leave the 9513 to continue to generate the pulse train unattended.

-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)

Reply to
Robert Scott

But we can still do the bulk of the work :-)

PROGRAM pulser(input)

CONST on = TRUE; off = FALSE;

VAR ontime, offtime : 0..maxint;

PROCEDURE setbit(onoff : boolean);

BEGIN (* system specific code *) END;

PROCEDURE delay(time : integer);

BEGIN (* system specific code *) END;

FUNCTION interrupted : boolean;

BEGIN (* system specific code *) END;

BEGIN (* pulser *) REPEAT read(ontime); IF ontime > 0 THEN BEGIN read(offtime); IF offtime > 0 THEN BEGIN REPEAT setbit(on); delay(ontime); setbit(off); delay(offtime) UNTIL interrupted; END; END; UNTIL (ontime

Reply to
CBFalconer

hehe. But I'd rather wait a little until I know more about what's desired to even recommend a cpu, at all.

Perhaps the pulse trains operate over periods of 10^9 years and need to be adjustable to the microsecond, with jitter and other errors no greater than a nanosecond. And the adjustments must be made by the user using telepathy. Who knows from the description?

Jon

Reply to
Jonathan Kirwan

A simple multivibrator would do.

Reply to
CBarn24050

Dear all,

The requirement details - On Time - 1 us ~ 9999 us. off Time - 1us ~ 9999 us. After user enter the on-time and off-time value, the pulse-training will be generated according to the setting.

The timing need to relative precise, +/- 0.5us. No jitter is allowed if possible. Does it possible to implement with 8253 ? or using9513 ? Does it easy to obtain ? thanks all. regards, lamb.

Reply to
lamb

It is easy to do with a 9513. Use a 1 MHz clock. The pre-load registers are 16-bits. So 1 - 9999 is covered well.

-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)

Reply to
Robert Scott

Hi, what you need is a micro with an 16bit capture compare module. You just setup the module and it produces the waveform without any processor intervention. There are plenty of suitable processors with this periferal, chosse the one you like.

Reply to
CBarn24050

Most capture/compare units that I am familiar with (i.e. PICs) cannot handle the OP's problem. He want two separate widths - one for on and one for off. The processor could alternate between these two, but not for extremely small pulse widths. There is no time to set up the next compare event if the pulse is only 1 usec. long. But the 9513 can do this.

-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)

Reply to
Robert Scott

Lots of others do (H8xxx series for a start) in some cases it is a matter of changing two values even if it has been set to PWM mode and effectively change the frequency as well if you like. That's how I setup simple panel dimming controls, a PWM that the on/off ratios are changed from software from 'switchs', external commands or reading of pot.

The H8 series tend to have several of them as well, so you could probably check your jitter if that worried :-^

I am sure the AVR, Z8 and others have one or more that can do this as well.

--
Paul Carpenter          | paul@pcserviceselectronics.co.uk
    PC Services
              GNU H8 & mailing list info
             For those web sites you hate
Reply to
Paul Carpenter

I think the timer on the MSP430 can handle that chore. You set up one of the PWM modes and use the CCR0 register to set the total interval (time on + time off). Then CCR1 is set to the time on. I used that method to generate a 500Hz clock with a variable duty cycle.

The PWM modes are set up so that everything is done in the processor--- you would have to have the processor monitor the output to stop the time if you wanted only one pulse, and not a continouous pulse train. I think it would meet the specs with a 8MHz clock, though.

Mark Borgerson

Reply to
Mark Borgerson

Those are very old devices - what you need is a 16 bit PWM module, that allows 16 bit define of timebase, and 16 bit define of duty cycle. Not all uC think like that, but the z8 encore is one that does, it calls the timebase reload value. I think it can run to the CLK freq, of 20MHz on the PWM, or us a prescaler. You will need HW, as SW will not easily cope with the 1us ON 1us OFF times.

Just choose the smallest z8Fxx that has the PWM - some come in DIP8, so you may be able to make a tiny Serial-PWM block. If you include the Prescale setting, you can create one that does 100ns-419ms with 1 part in 2^16 resolve.

-jg

Reply to
Jim Granville

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.