Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Peak detection source code, pic12f675

Status
Not open for further replies.

sanna

Member level 2
Joined
Jul 19, 2007
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,658
ac signal peak detector

Does any one have a code source for peak detection in c.

Thanks for all help and sujestions,
 

Re: Peak detection

the processor is pic12f675,
 

Peak detection

Any reason why you won't use an OPAmp ?
 

Re: Peak detection

I don't know c, but will give you code,

B0 = ( 16 bit variable of ADC )

B1 = ( 16 Bit variable of PEAK)

B1 = 0

main : if B0 > B1 then B1 = B0 '( B1 holds 16 bit peak )
---
---
---
---
goto main
 

Re: Peak detection

Hi!
Peak detection of an AC signal is a part of my current project. For accurate peak detection of an AC signal in software first you have to convert the AC to DC by using a bridge without any filter capacitor because the filter capacitor will deform the shape of the AC signal. The second step is to scaledown the signal to a maximum of 5V swing (within the range of PIC ADC).
After all this you have to sample the input signal at a good sampling frequency i.e about 2KHz. Compare each sample result to the previous sample to determine the maximum value of the signal which will be the peak.

All this stuff can be done quite easily in hardware (opamps).

Regards.
 

    sanna

    Points: 2
    Helpful Answer Positive Rating
Re: Peak detection

thanks alot,I will try this
 

Re: ac signal peak detector

/* init */
int peak=0;
/* peak detection on val */
if (val > peak)
{
peak = val;
}
/* when finished */
printf("peak=%d\n",peak);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top