i should repeat that=Lcd brightness doesnt change at normal work. when servo moves than it goes high or low...
my power supply is that.
switching adapter
input:ac 100-240V-50hz 0.36A
output:dc 5v--2.5A
and my program is that
Code:
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE OSC 4
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 100
SYMBOL F=PORTA.0
SYMBOL G=PORTA.1
alta var byte
usta var byte
altb var byte
ustb var byte
ADCON1=2
TRISA=3
TRISB=0
PORTB=0
TRISC=0
LCDOUT $FE,1
pause 4000
adcin 0,ALTa
ADCin 1,usta
t var byte
i var byte
T=150
yap:
adcin 0,altb
ADCin 1,ustb
if ((((usta+10)*100)/(ustb+10)))>135 then
T=T+15
endif
if (((alta*100)/altb))>135 then
T=T-15
endif
gosub motor
LCDOUT $fe,2,#usta," ",#ustb," ",#altA," ",#altb
goto yap
motor:
for i=0 to 25
PULSOUT PORTC.2,T
PAUSEUS 20000-(T*10)
next
return
end
Bookmarks