OK, the 555 is good trick, but if you use an LMC66x series op-amp and a single +12 volt supply, you have a 0-10 voltage amplifier with 3 parts! May be 2 more to filter PWM from PIC...
Ioannis
naga
If you use a PIC with Hardware PWM (eg 16F628) then varying the Duty in steps of 10% from 0 to 100% (see HPWM command) will give you your ten steps. A simple filter on the output will then give you ten voltage steps from 0v (0%) to 5v (100%).
I recall posting a circuit for an Op-Amp Voltage Doubler some time back. Do a forum SEARCH, stick that on the end of your filter and presto - you got ten steps of 0-10v.
http://www.picbasic.co.uk/forum/show...hlight=doubler
Is that it? I've got it on my 'hot' list of handy items to keep around...
Or you could use one of these (without the need for a separate high voltage supply):
http://www.microchip.com/wwwproducts...cName=en010581
The TCM828/829 are CMOS "charge-pump" voltage converters in ultra-small 5-Pin SOT-23A packages. They invert and/or double an input voltage which can range from +1.5V to +5.5V. Conversion efficiency is typically >95%. Switching frequency is 12kHz for the TCM828 and 35kHz for the TCM829. External component requirement is only two capacitors (3.3µF nominal) for standard voltage inverter applications. With a few additional components a positive doubler can also be built. All other circuitry, including control, oscillator, power MOSFETs are integrated on-chip. Supply current is 50µA (TCM828) and 115µA (TCM829). The TCM828 and TCM829 are available in a 5-Pin SOT-23A surface mount package.
Use Portc.1 or Portc.2 and HPWM (see page 73 of the manual)
B0 var Byte
Vduty var Byte
Vduty=0
B0=1
Main:
if UpButton =0 then
If Vduty<255 Then Vduty=Vduty+B0
Gosub HpwmSet
endif
if DownButton =0 then
If Vduty>0 then Vduty=Vduty+B0
Gosub HpwmSet
endif
goto Main
HpwmSet:
HPWM Channel, Vduty,Frequency
Return
with B0 = 1 you have 255 steps , if you want 10 steps set B0 = 25
UpButton and DownButton are two input ports with a 10K resistor pullup, the switch is normally open.
Al.
Sorry should be:
if DownButton =0 then
If Vduty>0 then Vduty=Vduty-B0
Gosub HpwmSet
endif
Hi all, no luck, Please gothru my code...Thanks.
Include "MODEDEFS.BAS" ' Include Shiftin/out modes
@ device PIC16F877A , xt_osc, wdt_on, pwrt_on, protect_on ,lvp_off
Define Osc 4 ' using a 4 MHz oscillator
; 76543210
TRISA = %00000000 ' ALL OUTPUTS
TRISB = %11111111 ' ALL INPUTS- KEYBRD
TRISC = %11110001 '
OPTION_REG.7=0 'Enable internal pull-ups
OPTION_REG = %11111000 ' Assign prescaller to WDT
TRISA = 0 ' Set PORTA as output
T1CON.1 = 0 ' Set TIMER1 clock source to internal clock
INTCON = %01000000 ' Enable peripheral interrupts
PIE1 = %00000001 ' Enable TMR1 overflow interrupt
CCP1CON=%00001100 ' PWM MODE
UpButton Var PORTB.0
DownButton var PORTB.1
PWMOut Var PORTC.1 ' PWM Output
DEFINE CCP1_REG PORTC 'Hpwm 1 pin port
DEFINE CCP1_BIT 2 'Hpwm 1 pin bit
DEFINE HPWM2_TIMER 1 'Hpwm 2 timer select
B0 var Byte
Vduty var Byte
Vduty=0
B0=1
pause 100
Main:
if UpButton =0 then
If Vduty<255 Then Vduty=Vduty+B0
Gosub HpwmSet
endif
if DownButton =0 then
If Vduty>0 then Vduty=Vduty-B0
Gosub HpwmSet
endif
goto Main
HpwmSet:
HPWM 1,25,1000 '4.00khz
'HPWM 1,25,250 '16.00khz. tried this also.
Return
Bookmarks