Bookmark this page:
Yahoo!
Windows Live
del.icio.us
digg
Netscape
|
|
|||||||||||||||||||||||||
|
Posted by on August 30, 2008, 12:51 pm
Please log in for more thread options Thank you everyone for your input to my earlier thread for my need of a one chip solution that directed my application to using a PIC. As a new PIC learner can you give me a PIC choice & part # (kit) that has the flexibility I need for my application? Also a good webpage for PIC projects would also be helpful. I have several years of old experience, covered in cob webs, in the use of 8080 Assembly & Basic programming languages which hopefully will allow me to grasp the PIC language quickly. Webpage link to my application need: http://www.oldtemecula.com/theremin/tan/index.htm My need in the ideal PIC (AFC) application: A PIC samples its Input every 10 minutes from a manually activated & conditioned Update Pulse. The Input is sampled for a 200 Hz frequency in a 1/2 sec timing window and compared to 100. It has a possible count value above or below a 100. PIC INPUT = 1 Volt p-p AC @ 50 Hz - 300 Hz PIC OUPUT = 5v to 6v DC @ 1 ma with a resolution of 100 increments. PIC features: OP Amp F-V ADC Latch DAC * * * Below is a first attempt not knowing any PIC language using some past terms for crude logic in my Automatic Frequency Control. I will refine the logic when I get a specific PIC for my application. Dim vInput_count %, vOutput_V% vOutput_V = 5.5v PIC_Output = vOutput_V ' set PIC Output to 5.5 volts label1: If Terminate_ Pressed then End vInput_count = PIC_Input '1/2 second PIC frequency Input sample" If vInput_count > 100 then
vOutput_V = vOutput_V - .01 'minus .01 volts from PIC Output
'lowers the frequency at the PIC Input. PIC_Output = vOutput_V Goto label1 Else If vInput_count < 100 then vOutput_v = vOutput_V + .01 'adding .01 volts to Output raises 'the frequency at the PIC Input. PIC_Output = vOutput_V Goto label1 End if 'Program proceeds when Input_count = 100 Do until Update pressed 'Wait for 10 minute signal to Update 'sample at the PIC Input. Loop Goto Label1 End * * * * Christopher Temecula CA.USA http://www.oldtemecula.com | |||||||||||||||||||||||||
|
Posted by RD on August 30, 2008, 3:57 pm
Please log in for more thread options christopher@REMOVEoldtemecula.com says... [snip] > PIC INPUT = 1 Volt p-p AC @ 50 Hz - 300 Hz
> > PIC OUPUT = 5v to 6v DC @ 1 ma with a resolution of 100 increments. I don't have any direct experience with the dsPIC's (the ones with the built-in DAC output), but I'm fairly certain they provide a steady output voltage level between 0 and 5 volts. You'd have to provide a DC offset somehow to reach your 5-6 volt range. On the plus side, since the DAC is 16-bit, your one volt range would have a resolution of 2^16 * 0.2 = 13,107 increments. :) You mention an Op-Amp as a feature of your 'ideal' PIC; many PIC's have an on-board Comparator, although you'd have to read up on how it's used on your specific PIC. It may or may not be what you want. > The Input is sampled for a 200 Hz frequency in a 1/2 sec timing window
Use a high-gain transistor to convert your signal to a square wave and get your PIC to count the number of 1->0 transitions in your
1/2 second window:
+5v | .-. | | 10k | | '-' |----- PIC digital input Audio | In || _R_ |/ -||--|___|--| || |>
|
--- - (created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de) | |||||||||||||||||||||||||
|
Posted by petrus bitbyter on August 30, 2008, 5:12 pm
Please log in for more thread options
>
> > Thank you everyone for your input to my earlier thread for my need of > a one chip solution that directed my application to using a PIC. > > As a new PIC learner can you give me a PIC choice & part # (kit) that > has the flexibility I need for my application? Also a good webpage for > PIC projects would also be helpful. I have several years of old > experience, covered in cob webs, in the use of 8080 Assembly & Basic > programming languages which hopefully will allow me to grasp the PIC > language quickly. > > Webpage link to my application need: > > http://www.oldtemecula.com/theremin/tan/index.htm > > > My need in the ideal PIC (AFC) application: > > A PIC samples its Input every 10 minutes from a manually activated & > conditioned Update Pulse. The Input is sampled for a 200 Hz frequency > in a 1/2 sec timing window and compared to 100. It has a possible > count value above or below a 100. > > PIC INPUT = 1 Volt p-p AC @ 50 Hz - 300 Hz > > PIC OUPUT = 5v to 6v DC @ 1 ma with a resolution of 100 increments. > > PIC features: > OP Amp > F-V > ADC > Latch > DAC > > * * * > Below is a first attempt not knowing any PIC language using some past > terms for crude logic in my Automatic Frequency Control. I will refine > the logic when I get a specific PIC for my application. > > Dim vInput_count %, vOutput_V% > > vOutput_V = 5.5v > PIC_Output = vOutput_V ' set PIC Output to 5.5 volts > > > label1: > > If Terminate_ Pressed then End > > vInput_count = PIC_Input '1/2 second PIC frequency Input sample" > > If vInput_count > 100 then > vOutput_V = vOutput_V - .01 'minus .01 volts from PIC Output > 'lowers the frequency at the PIC Input. > PIC_Output = vOutput_V > > Goto label1 > > Else > > If vInput_count < 100 then > vOutput_v = vOutput_V + .01 'adding .01 volts to Output raises > 'the frequency at the PIC Input. > > PIC_Output = vOutput_V > > Goto label1 > > End if 'Program proceeds when Input_count = 100 > > > Do until Update pressed 'Wait for 10 minute signal to Update > 'sample at the PIC Input. > Loop > > Goto Label1 > > > End > > > * * * * > > Christopher > > Temecula CA.USA > http://www.oldtemecula.com Look at: http://www.voti.nl/swp/n_index.html for an intro using PICs. You find that even some small PICs have A/D on board. Some with eight, some with ten bits. Using them at frequencies as low as 200Hz will be no problem at all. But.... This is about measuring and keeping a voltage. If you want to measure frequency, you will need no A/D-conversion at all. Every PIC I know about has one or more counters to help measuring frequencies. An - 8 pins - PIC12F629 for instance, also has build in comparators to make nice digital pulses from your AC input. If you need more output pins a PIC16F684 (14 pins) will do. The D/A is not that easy. The most simple solution will be PWM. You'll need a very good low pass filter to get rid of the sample frequency which in turn will make output changes slow. A good and rock-stable way is an R/2R network. You'll need 14 resistors and 7 output pins to achive 100 (128 to be excact) step resolution. Both are described in: http://ww1.microchip.com/downloads/en/AppNotes/00655a.pdf A more attractive way is using a D/A-convertor. A TC1320 for instance is a good choice. But the 8-pins chip uses an I2C interface which will be hard to inplement for a beginner. You can however find example code at Microchips. For the PIC a PIC12f629 will do. In all solutions described above you will need an amplifier if you need an output voltage >5.5V.
petrus bitbyter | |||||||||||||||||||||||||
|
Posted by Paul E. Schoen on August 30, 2008, 9:13 pm
Please log in for more thread options
>
> The D/A is not that easy. > The most simple solution will be PWM. You'll need a very good low pass > filter to get rid of the sample frequency which in turn will make output > changes slow. > A good and rock-stable way is an R/2R network. You'll need 14 resistors > and 7 output pins to achive 100 (128 to be excact) step resolution. Both > are described in: > http://ww1.microchip.com/downloads/en/AppNotes/00655a.pdf > A more attractive way is using a D/A-convertor. A TC1320 for instance is > a good choice. But the 8-pins chip uses an I2C interface which will be > hard to inplement for a beginner. You can however find example code at > Microchips. For the PIC a PIC12f629 will do. > In all solutions described above you will need an amplifier if you need > an output voltage >5.5V. I agree with your recommendations, but I found that it is possible to make a voltage doubler with the PWM output that can be programmed for a range of about 4 VDC to 6 VDC. It requires only two capacitors, two resistors, and a diode. It might need to be monitored by one of the ADCs and trimmed, or if the load is stable, you could make a table of PWM values and output voltages. The LTspice ASCII for the circuit is at the end. The simulated outputs with a 10 kHz PWM into a 5 kOhm load after 100 mSec are as follows: 0% 4.07 VDC 5% 4.24 VDC 10% 4.40 VDC 20% 4.72 VDC 30% 5.04 VDC 40% 5.33 VDC 50% 5.62 VDC 60% 5.86 VDC 70% 6.05 VDC 80% 6.09 VDC 85% 5.98 VDC 90% 5.64 VDC Paul ============================================================================== Version 4 SHEET 1 880 680 WIRE -32 16 -64 16 WIRE 160 16 32 16 WIRE 80 80 32 80 WIRE 160 80 160 16 WIRE 160 80 144 80 WIRE 256 80 160 80 WIRE 544 80 336 80 WIRE 608 80 544 80 WIRE 608 128 608 80 WIRE -64 144 -64 16 WIRE 32 144 32 80 WIRE 544 144 544 80 WIRE -64 256 -64 224 WIRE 32 256 32 224 WIRE 32 256 -64 256 WIRE 80 256 32 256 WIRE 544 256 544 208 WIRE 544 256 80 256 WIRE 608 256 608 208 WIRE 608 256 544 256 WIRE 80 304 80 256 FLAG 80 304 0 SYMBOL voltage 32 128 R0 WINDOW 3 13 107 Left 0 WINDOW 123 0 0 Left 0 WINDOW 39 37 52 Left 0 SYMATTR InstName V1 SYMATTR Value PULSE(0 5 100n 100n 100n 80u 100u 2000) SYMATTR SpiceLine Rser=200 SYMBOL cap 144 64 R90 WINDOW 0 0 32 VBottom 0 WINDOW 3 32 32 VTop 0 SYMATTR InstName C1 SYMATTR Value 1µ SYMBOL cap 560 208 R180 WINDOW 0 24 64 Left 0 WINDOW 3 24 8 Left 0 SYMATTR InstName C2 SYMATTR Value 10µ SYMBOL schottky -32 32 R270 WINDOW 0 32 32 VTop 0 WINDOW 3 0 32 VBottom 0 SYMATTR InstName D1 SYMATTR Value 1N5818 SYMATTR Description Diode SYMATTR Type diode SYMBOL res 592 112 R0 SYMATTR InstName R1 SYMATTR Value 5k SYMBOL voltage -64 128 R0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V2 SYMATTR Value 5 SYMBOL res 352 64 R90 WINDOW 0 0 56 VBottom 0 WINDOW 3 32 56 VTop 0 SYMATTR InstName R2 SYMATTR Value 1k TEXT 118 280 Left 0 !.tran 200m startup | |||||||||||||||||||||||||
|
Posted by petrus bitbyter on August 31, 2008, 8:59 am
Please log in for more thread options
>
>>
>> The D/A is not that easy. >> The most simple solution will be PWM. You'll need a very good low pass >> filter to get rid of the sample frequency which in turn will make output >> changes slow. >> A good and rock-stable way is an R/2R network. You'll need 14 resistors >> and 7 output pins to achive 100 (128 to be excact) step resolution. Both >> are described in: >> http://ww1.microchip.com/downloads/en/AppNotes/00655a.pdf >> A more attractive way is using a D/A-convertor. A TC1320 for instance is >> a good choice. But the 8-pins chip uses an I2C interface which will be >> hard to inplement for a beginner. You can however find example code at >> Microchips. For the PIC a PIC12f629 will do. >> In all solutions described above you will need an amplifier if you need >> an output voltage >5.5V. >
> I agree with your recommendations, but I found that it is possible to make > a voltage doubler with the PWM output that can be programmed for a range > of > about 4 VDC to 6 VDC. It requires only two capacitors, two resistors, and > a diode. It might need to be monitored by one of the ADCs and trimmed, or > if the load is stable, you could make a table of PWM values and output > voltages. The LTspice ASCII for the circuit is at the end. The simulated > outputs with a 10 kHz PWM into a 5 kOhm load after 100 mSec are as > follows: > <snip spice list>
Think this comes very close to the OPs requirements. It'll be a challenge to keep the voltage stable while measuring the frequency but even a 12F629 has two timers available so it wil not be that hard. There's no need to drive a PIC to its limits by using 5.5V power. Ordinary stabilized 5V will do. Where did you got this idea from? petrus bitbyter | |||||||||||||||||||||||||

PIC - Recommendation for a first time user
Yahoo!
Windows Live
del.icio.us
digg
Netscape 







