summaryrefslogtreecommitdiff
path: root/n/line-follower/src/pwm.c
diff options
context:
space:
mode:
authorprot2004-12-20 15:49:47 +0000
committerprot2004-12-20 15:49:47 +0000
commit792e00386f06f5d71ae4019e4d07ee335290608e (patch)
treed107c9553bbf7295056493188d9f4ed183f35705 /n/line-follower/src/pwm.c
parent767c8d28dae96ad41ab3b4dd333b4004e9b5f9ca (diff)
Added :
- specialized coefs for linefol - protocol for changing these coefs ('I') - protocol for pid components stats ('C')
Diffstat (limited to 'n/line-follower/src/pwm.c')
-rw-r--r--n/line-follower/src/pwm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/n/line-follower/src/pwm.c b/n/line-follower/src/pwm.c
index 9c5d15e..15da89d 100644
--- a/n/line-follower/src/pwm.c
+++ b/n/line-follower/src/pwm.c
@@ -51,7 +51,7 @@ pwm_init (uint8_t n)
Fpwm = f_IO / (2 * prescaler * TOP) = 28912 Hz. */
switch (n)
{
- case 0:
+ case 0:// f = f0 = 28912 Hz, PWM = 8bits
default:
TCCR1A =
regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
@@ -59,21 +59,21 @@ pwm_init (uint8_t n)
TCCR1B = regv (ICNC1, ICES1, 5, WGM13, WGM12, CS12, CS11, CS10,
0, 0, 0, 0, 0, 0, 0, 1);
break;
- case 1:
+ case 1:// f = f0 / 2 = 14456 Hz, PWM = 9bits
TCCR1A =
regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
0, 0, 1, 0, 1, 0, 1, 0);
TCCR1B = regv (ICNC1, ICES1, 5, WGM13, WGM12, CS12, CS11, CS10,
0, 0, 0, 0, 0, 0, 0, 1);
break;
- case 2:
+ case 2:// f = f0 / 4 = 7228 Hz, PWM = 10 bits
TCCR1A =
regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
0, 0, 1, 0, 1, 0, 1, 1);
TCCR1B = regv (ICNC1, ICES1, 5, WGM13, WGM12, CS12, CS11, CS10,
0, 0, 0, 0, 0, 0, 0, 1);
break;
- case 3:
+ case 3:// f = f0 / 8 = 3614 Hz, PWM = 8 bits
TCCR1A =
regv (COM1A1, COM1A0, COM1B1, COM1B0, COM1C1, COM1C0, WGM11, WGM10,
0, 0, 1, 0, 1, 0, 0, 1);