Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PWM LED @ Atmega16

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
852 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 6, 2010

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.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more