Assembler Code Question

Would anyone here be willing to have a look, maybe off-list, at an Assembler routine that was written for me several years ago?

It is a five channel sinewave generator using LUT's on a PIC micro.

I am not a coder, but need to know how to make changes in stp1hi EQU and stp1lo EQU values in order to derive different frequencies.

I also would like to know the definition of a "PWM factor" is, and how it relates to the above process.

Otherwise, is there a good online forum specifically for Assembler? Can't seem to find a very active one.

Ken Rockwell

Reply to
krockwell
Loading thread data ...

Ken, if you don't have any success here, try posting on the microchip tech forums. Lots of clever & helpful guys there.

You need to register to post, easily done though.

formatting link

Reply to
Rodwell

Try asking over in comp.arch.embedded.

Perhaps stp1h1 and stp1lo are constants that define the on- and off-time for a "pulse width modulator" (PWM). Changing those, if that's what they are, would change the length (period) and duty cycle of a square wave signal. A 50% duty cycle wavetrain could be passed through an analog filter to remove all but the fundamental sine wave (for some definitions of "all").

An approach that needs less filtering is "direct digital synthesis" (DDS) which sounds fancy but really is nothing more than a look-up table, an accumulator, and frequency-determining factor that gets added to the accumulator at periodic intervals. The accumulator is then used to index into the look-up table.

If the code has a look-up table that defines a complete, half, or quarter cycle then I'd guess you're looking at a DDS. Not sure where PWM would be needed in that case, though.

Reply to
Rich Webb

You can use any old text edit program to make the change. You then need to create a new binary using an assembler (ie the one that comes with Microchip's MPLAB). Then you need to use a tool similar to "PicKit 2" to copy the new binary into the device.

That's a good question. Pulse Width Modulation varies the width of a pulse in same manner that Frequency Modulation varies the frequency of a wave. A search of "PWM factor" causes "Power Factor" to jump out at me. If it's the case that "PWM factor" is short hand for "PWM Power Factor" then possibly the intention is to vary the Power Factor proportional to the Pulse Width. Perhaps to add capacitance to compensate for inductive loads.

Your question may be more of a PIC question than an Assembler question. MIT's Piclist is the best place for PIC questions. It's a standard mail list. See

formatting link

Here's a synopsis of how it works. Prefix your subject line with [PIC]. Email your question to snipped-for-privacy@mit.edu. (IIRC Piclist is moderated.) Read the responses (if any) to your question by clicking on "Today" at

formatting link

--
Don Kuenz
Reply to
Don Kuenz

Try the microchip forums or I've found the 'PIC list' to be very usefull.

But usually there is a LUT with SIN values for a sine wave. These are written to the PWM module at a rate that determines the frequency.

Cheers

Reply to
Martin Riddle

schreef in bericht news: snipped-for-privacy@4ax.com...

Where's that routine? Did I miss it, did my newsserver miss it or didn't you provide it?

petrus bitbyter

Reply to
petrus bitbyter

As mentioned, try posting on comp.arch.embedded. Actually including the listing, if it's no more than 40 lines or so (or better, less than 10) will help.

I only do that kind of stuff for pay -- picking through code is WORK! But you might get lucky with one of the comp.arch.embedded guys.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

I'm guessing stp1hi and stp1lo are high and low bytes (words?) for the DDS phase accumulator step size.

PWM factor possibly controls the amplitude of the modulation.

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

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.