Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC code modification

Status
Not open for further replies.

darryl_co

New Member
Hi,
I have a code for PIC12F508 as a sweep oscillator that sweeps non linearly from 1200Hz to 14KHz and has two outputs out of phase to each other.I need help in modifying the code to
1) Set the sweep range to 20Hz to 20KHz in one second
2) Frequency step of 1Hz
3) A third output with 1Hz frequency for driving LED
Please help!
 
PIC 16F84 Code checking

deleted!
Request Please do not merge two topics just because it is posted by the same user in the same category.
The help required is different and the component also.
It created a confusion with the reader thinking that I wanted sine wave from pic12f508 which was actually a output in the pic16f84 circuit.
The request was for checking the code of pic16f84 and i case of pic12f508 modification.
Pleeeeeeease
 
Last edited:
hi,
The asm runs OK in Oshonsoft simulation.

This image is the output of the low nibble on PORTB.

EDIT: also the *.hex checks out OK.
 
Last edited:
Why do you think the upper limit is currently 14KHz? - an obscure value I'm sure you'd agree.

You lost me, Nigel. Would you tell us why you think the upper limit is currently 14 kHz, please?

Thank you.

<added>

Ok, wait a minute. The cumulative periods at 1-Hz intervals will take much longer than 1 second. Sorry... Still workin' on my first cup of coffee here Gentlemen (lol)...
 
Last edited:
You lost me, Nigel. Would you tell us why you think the upper limit is currently 14 kHz, please?

As you've no doubt now realised, it takes considerable time to send out multiple bytes to create the sinewave - this limits the highest frequency as you can't send it fast enough.

To overcome the limitation you can either increase the PIC clock speed (which is obviously limited) or reduce the number of samples used for the sinewave, reducing the quality.
 
Hi Nigel,

I didn't see anything in the OP's post or in the program listing to suggest the use of sine waves. Did I miss something Sir?
 
I'm not sure where he got that from either.

More to the point then, I suppose, if you generate a single cycle of each frequency starting at 20 Hz (a 50-msec period), in 1 Hz increments, you'll have used up just over one second by the time you finish generating one cycle at 53 Hz.

Regards, Mike
 
Last edited:
I'm not sure where he got that from either.

More to the point then, I suppose, if you generate a single cycle of each frequency starting at 20 Hz (a 50-msec period), in 1 Hz increments, you'll have used up just over one second by the time you finish generating one cycle at 53 Hz.

Regards, Mike

If it is not possible to complete the cycle in 1 second, are the other things possible like linear sweep and extended range ? how?
 
Is that all?

1st question: where is the label "ofloop" in your code?
2nd question: is non-linear sweeping? What does it mean actually?
 
Last edited:
It might help if you mentioned EXACTLY what you're trying to do?.

I am trying to replace the 555 used in my other post of a pipe descaler under the heading "Class D amplifier driven by 555 output" to get wider frequency range.
This is just a code found for the pic12f508.I do not mind using any other pic.I did a google search for sweep oscillator using pic but could not find one.
As pointed out by Mike the sweep is not possible in a second and by calculation it would take around 7 seconds for 1 cycle of 20hz to 20khz.So a step of 8 hz would be ideal needing 0.9 sec or 10hz step needing 0.7 sec which would be easy to divide.
I am a newbie at PIC.I tried to learn myself but could not learn the look up table codes.I used Real PIC simulator but if done step wise it comes to the same point in the table and the output is not a sweep frequency. In free run the output shows a sweep.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top