PIC Interrupter Program

EDY19, Tue May 23 2006, 09:28PM

edit: Look down, objectives changed wink

Im looking for a 555 timer circuit that has a potentiometer to vary the frequency, as well as a potentiometer to vary the on time of the pulse, and I seem to be having trouble. Any ideas? (Its for a DRSSTC interrupter, but i thought it is more of a general question) Does anyone see an advantage to using a circuit tha controls the on and off time rather than the frequency and the on time? It seems the latter would be better, but maybe not smile
Re: PIC Interrupter Program
Avalanche, Tue May 23 2006, 09:44PM

I've made a similar thing before by using a dual timer chip (7556)

The first timer has a fixed pulse width, of only a few microseconds, and has a pot to vary the frequency at which the pulse occurs. The output from this timer triggers the second timer (running as a monostable) which has a pot to vary the on time.

So in effect you have one pot for frequency, and the other for pulse width, or on time. It seems quite a precise way to do it, because there is no interference between the on time and the frequency when you adjust the pots.
Re: PIC Interrupter Program
Sulaiman, Wed May 24 2006, 01:03AM

A single 555 is adequate for ON time and OFF time of a typical(?) drsstc
In classic Astable mode the output is long ON time (high)
and short OFF time (low on pin3)
which is 'upside down'
"Single shot" is usefull.
Re: PIC Interrupter Program
EDY19, Wed May 24 2006, 01:20AM

I was just thinking it would be nice to have it callibrated for bps from say 20 to 200 bps, and then on times from 0 to 200uS or so (not really sure, just guesses right now). With the other type (on and off time) the frequency would have to be calculated from the on and off times, id rather just look at a knob smile
Re: PIC Interrupter Program
Part Scavenger, Wed May 24 2006, 11:57AM

Steve Ward's new interrupter does that IIRC... It's on his site, in the SSTC/DRSSTC section.

EDIT=> Yeah, right here Link2
Re: PIC Interrupter Program
Quantum Singularity, Thu May 25 2006, 01:09AM

There are other chips available for freq and pulse width control... I dont beleive any circuit I have ever seen has 1 pot for freq and 1 pot for duty cycle on a 555. I could be wrong but I think in all the circuits I have seen adjusting 1 pot will throw off both parameters. Can anyone else corroborate this? I seem to remember building a freq generator from one once and having issues adjusting it to cover a wide range accurately with just one pot. Seems like you had to adjust both pots for a simple freq change to keep everything else the same.
Re: PIC Interrupter Program
EDY19, Thu May 25 2006, 01:22AM

I'm actually thinking of starting a new project with this one- use a 556 timer to get the control with the on time and the frequency, then use a microcontroller to measure the frequency, and on and off times, and display that on an LCD screen (16x2). Any suggestions on how to start programming that? I'm going to look over the commands and see if i can figure something out, but any help would be greatly appreciated because anything i do right now is complete guesswork!

The TL494 allows you to change frequency with one potentiometer and duty cycle with the other, but in the layout i used, the duty cycle could only be brought from 0 to about 50%.
Re: PIC Interrupter Program
..., Thu May 25 2006, 02:27AM

um, if you are going to get a pic into the loop why not ditch the 555 altogether?

Any simple 14 pin pic should work fine, you use 7 lines for the hd44780 display, one for the output, and 2 for the pots... You don't need hardware anything on the pic, just create a r/c network across an i/o pin like
vdd-cap-pic i/o pin
        -pot-ground
then you set the i/o pin high, which discharges the cap, then you set it to input mode and wait until the cap charges through the pot below the threshold level of the pin(this time will be proportional to the resistance of the pot).

Since this is for a drsstc you can do the read the pots/display the value/calculate the required number of cycles for the on part and the rest of the off part during the 'off' part of the burst. Then you just wait the calculated amount of cycles, then turn a pin on for the required number of cycles, then read the pots/etc again.
Re: PIC Interrupter Program
rupidust, Thu May 25 2006, 02:52AM

If you go PIC route, you are moving into a Function Generator. And like ... said might as well get rid off 555 and external chips. The code to count and constantly update an LCD is more involved than that of the code to change duty and frequency, from an experience view point. If you have not done either, the difficulty is the same.

I have already done this for booster and ignition coil drivers with/without LCD. Whats the difference? The load and the feedback.

3 button booster interface.
1144021134 110 FT6457 Lcdbooster

Also see reference post: Link2
Re: PIC Interrupter Program
Wolfram, Thu May 25 2006, 09:12PM

I started a project like this once, and Bjørn wrote some excellent routines for the timing. You gave them the number of µS on-time and the number of µS off-time and it generated the squarewave. I was going to use a button-triggered interrupt to set the freq/duty cycle. I was going to make three modes, freq/duty cycle, freq/on-time, and on-time/off-time. If it's okay with him, I'll post the routines here.
Re: PIC Interrupter Program
EDY19, Fri May 26 2006, 12:37AM

Yup, that is exactly what i am looking for, Anders! What chip is it for? Just any PIC? I was thinking the 16F628, did that one have a display as well?
Re: PIC Interrupter Program
Wolfram, Fri May 26 2006, 01:00AM

It should work for any PIC12/PIC16.

He wrote three routines, but only one of them seems suitable for this, he gave me permission to post it.

As it stands now minimum on-time is 18µS, adjustable in 3µS steps, max 10s when running the PIC at 4MHz. The same applies to the off-time.

wloop	bsf	PORTB,1
	movfw	on1
	movwf	t1
	movfw	on2
	movwf	t2
	movfw	on3
	movwf	t3
	goto	wl1

wl1	decfsz	t1
	goto	wl1
	nop

	decfsz	t2
	goto	wl1
	nop

	decfsz	t3
	goto	wl1
	nop

	bcf	PORTB,1
	movfw	off1
	movwf	t1
	movfw	off2
	movwf	t2
	movfw	off3
	movwf	t3

wl2	decfsz	t1
	goto	wl2
	nop
	
	decfsz	t2
	goto	wl2
	nop

	decfsz	t3
	goto	wl2
	nop

	goto	wloop

The program was written by Bjørn Bæverfjord.
Re: PIC Interrupter Program
EDY19, Fri May 26 2006, 12:26PM

So the output would be on pin 7 on a 16F628, correct? That pin is labeled RB1. Also, I plan on changing the oscillator to 16MHz, so what values would I have to change for the timing, and multiply them by 4 to get the same time, right? Lastly, what compiler/programmers do you use? Thanks for all the help, this is my first programming project ever smile And it would be nice if it worked correctly.
Re: PIC Interrupter Program
Wolfram, Fri May 26 2006, 01:56PM

As of now, this is just the code to do the timing. Running it at 12MHz would let you control it in steps of 1µS, with the lowest on-time as 6µS. 6µS is quite a bit when it comes to DRSSTC stuff, so I guess the code would have to be modified to allow lower minimum on-time to be good for DRSSTC stuff.
Re: PIC Interrupter Program
EDY19, Fri May 26 2006, 10:24PM

Well, looking at steve wards site
Link2
the burst length goes from 60uS up to 200uS at 120bps, so I don't see how 6 would be a problem. Is 120bps the same as 120 Hz?
Re: PIC Interrupter Program
Steve Conner, Fri May 26 2006, 10:33PM

I designed a DRSSTC interrupter circuit with two 555s (or a 556) like what Avalanche suggested. One pot adjusts the frequency from "Single shot" up to 200Hz and the other adjusts the on-time from 5 to 300us. When the frequency pot is turned to "Single shot", pressing the button triggers a single pulse.

Both pots are linear, so you could use 10-turn pots with counter dials and read the frequency and on-time directly. The op-amp is really just there to make the frequency pot linear.

Link2

I've also made an interrupter driven by a PIC, but I decided the analog circuit above was less hassle. It took about a day to design, build and get working. The PIC interrupter was a fancy unit that made clumps of up to 64 pulses with pseudo-random delays between them, the idea being to produce a big fat spark from an old SSTC design that couldn't do anything too impressive with just one pulse.

Yes 120bps is the same as 120Hz.
Re: PIC Interrupter Program
EDY19, Fri May 26 2006, 11:11PM

I think that the easiest way for the actual signal is by far the 556 timer. Thats what I think I'll go with just for the sake of not bothering so many people about coding the PIC. But, I still have to make the display, thats one of the requirements for me. Steve, you don't happen to have a PCB file for that 556 or 555 thing, do you? It should be a great thing to have around as a oscillator for lots of different projects, as well. So drop the PIC oscillator thing, I think I will just use it as a display. I found a site
Link2
which has a program labeled weedfreq8x2LCD
which is a frequency counter with an output for a LCD display (8x2) I would like to change this to a 16x2 display though as well as adding on and off times. Hints are greatly appreciated!
When you say "interrupter output active low," does that mean that when the driver is low, that corresponds to the on time? Lastly, I want to cut out the single shot switch from the 556 timer portion and add it to the PIC circuit, there will be a switch to switch modes between single shot and oscillator. In order to do this, I can pretty much just take out the whole IC3A section, and connect the reset of the 555 to Vcc, right?
Sorry for all the questions but i want this project to turn out right! wink
Re: PIC Interrupter Program
Steve Conner, Sat May 27 2006, 02:30PM

Hi edy

If you're wanting an LCD readout, I would say it actually becomes easier to do the whole thing digitally in a PIC. I designed my circuit so you could use 10-turn pots with counter dials to get a mechanical readout. If you do bolt a PIC onto an analog pulse generator, you have to deal with problems like:

How do you read the pulse width accurately?
How can you update the display when the fire button isn't pressed (and hence the oscillator is doing nothing)

I also did a PIC interrupter that uses a DDS algorithm to give breakrates from 0 to 1000bps, but I ended up building the analog one because I couldn't be bothered coding a user interface for it.

Yes, the output is high all the time and goes LOW to fire the burst.

No, there is no PCB. It took me less time to slap it together on a piece of stripboard than it would to lay it out in Eagle. Of course I'm not stopping any of you guys designing one if you want to. tongue

The switch isn't a single shot/repetitive select switch, it's a fire button. The unit only gives pulses while the button is pushed in. If you push it while the breakrate pot is turned all the way down, you only get one pulse per push of the button. I don't know how you would adapt that to a PIC. You are right that you wouldn't need IC3A: it's only there to debounce the switch.


1148740227 30 FT10039 Img 1465 Small
Re: PIC Interrupter Program
Wolfram, Sat May 27 2006, 02:46PM

Steve, would you mind sharing the code you wrote? I might have the time to code an interface for it.
Re: PIC Interrupter Program
EDY19, Sat May 27 2006, 04:22PM

Second thoughts, maybe using the PIC all the way would be easier display wise as well as the single shot and oscillator interface. I was thinking a rotary encoder (say 24 switches per rotation) would be good, as this keeps the information digital instead of using potentiometers. For every 15 degrees the switch is rotated (one pulse) the frequency could jump by 5Hz and the duration of the pulse from 10uS-300uS, with a second mode for single shot or a switch or something. I think this would be easier than using the 555s and the potentiometers for getting the frequency and on/off time displayed.

edit: Trying to think how a rotary encoder can "think" it is going forwards or backwards-wait, i dont think that it can tell tongue . Looks like we may have to go with a potentiometer and an analog to digital converter- darn, more programming...

Edit: Moved to computer science considering it has more to do with programming now