www.wortal.freelancemedia.pl
Kod BASCOM:
Dostępny także tutaj: http://pastebin.com/Y77c4Kt0
**********************************
$regfile "m16def.dat"
$crystal = 16000000
Dim R As Word
Dim L As Word
Config Timer1 = Pwm , Pwm = 10 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down
Config Adc = Free , Prescaler = Auto , Reference = Avcc
Start Adc
Enable Interrupts
Config Portd.5 = Output
Config Portd.4 = Output
Do
Pwm1a = 0 'pwmy na 0
Pwm1b = 0
For R = 0 To 512 'petla zapalajaca diody (dodaje wartosc wypelnienia impulsu do polowy) 'aby dioda nie swiecila zbyt jasno
Pwm1a = Pwm1a + 1
Pwm1b = Pwm1b + 1
Waitms 1
Next R
For L = 0 To 512 'petla gaszaca diody
Pwm1a = Pwm1a - 1
Pwm1b = Pwm1b - 1
Waitms 1
Next L
Loop
End
**********************************
Diodki podłączamy pod PORTD.5 i PORTD.4 i do masy układu.
Link to this comment:
All Comments (0)