Subversion Repositories HomeAutomation

Rev

Rev 2095 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2095 Rev 2108
Line 21... Line 21...
21
# will give 120Hz PWM, adjust CS to change frequency
21
# will give 120Hz PWM, adjust CS to change frequency
22
 
22
 
23
# for channel 3 or 4:
23
# for channel 3 or 4:
24
# COM=2, WGM= 1, CS=3
24
# COM=2, WGM= 1, CS=3
25
# will give 240Hz PWM, adjust CS to change frequency
25
# will give 240Hz PWM, adjust CS to change frequency
-
 
26
 
-
 
27
#Channel 1 and 2 is attached to the 16 bit timer 1
-
 
28
#Channel 3 and 4 is attached to the 8 bit timer 0
-
 
29
 
-
 
30
#### PWM Channel 1 and 2 ####
-
 
31
# COM-modes:
-
 
32
#   In Fast PWM mode:
-
 
33
#     0 - Disabled
-
 
34
#     1 - Toggle OC1A on compare match, OC1B disabled (if WGM = 14 or 15)
-
 
35
#     2 - Clear output on Compare match, set at bottom (non-inverting)
-
 
36
#     3 - Set output on Compare match, clear at bottom (inverting)
-
 
37
#   In Phase correct mode:
-
 
38
#     0 - Disabled
-
 
39
#     1 - Toggle OC1A on compare match, OC1B disabled (if WGM = 9 or 11)
-
 
40
#     2 - Clear output on compare match when upcounting
-
 
41
#         set when downcounting
-
 
42
#     3 - Set output on compare match when upcounting
-
 
43
#         clear when downcounting
-
 
44
#
-
 
45
# WGM-modes:
-
 
46
#  Mode    "TOP"     "Update Output"  "Name"
-
 
47
#     0 -  0xFFFF      Immediate      Normal
-
 
48
#     1 -  0x00FF         Top         PWM, Phase correct, 8-bit
-
 
49
#     2 -  0x01FF         Top         PWM, Phase correct, 9-bit
-
 
50
#     3 -  0x03FF         Top         PWM, Phase correct, 10-bit
-
 
51
#     4 -  0CR1A       Immediate      CTC
-
 
52
#     5 -  0x00FF        Bottom       PWM, Fast, 8-bit
-
 
53
#     6 -  0x01FF        Bottom       PWM, Fast, 9-bit
-
 
54
#     7 -  0x03FF        Bottom       PWM, Fast, 10-bit
-
 
55
#     8 -  ICR1          Bottom       PWM, Phase and frequency correct
-
 
56
#     9 -  OCR1A         Bottom       PWM, Phase and frequency correct
-
 
57
#    10 -  ICR1           Top         PWM, Phase correct
-
 
58
#    11 -  OCR1A          Top         PWM, Phase correct
-
 
59
#    12 -  ICR1        Immediate      CTC
-
 
60
#    13 -  Reserved
-
 
61
#    14 -  ICR1          Bottom       PWM, Fast
-
 
62
#    15 -  OCR1A         Bottom       PWM, Fast
26
 
63
 
27
#### PWM Channel 1, EXP_B, Timer1, OC1B ####
64
#### PWM Channel 1, EXP_B, Timer1, OC1B ####
28
 
65
 
29
# Select Compare Output Mode, act_hwPWM_CHx_COM
66
# Select Compare Output Mode, act_hwPWM_CHx_COM
30
# Set to 0 to disable this channel
67
# Set to 0 to disable this channel
31
# See datasheet for more information
68
# See datasheet for more information
32
act_hwPWM_CH1_COM=0
69
act_hwPWM_CH1_COM=0
33
 
70
 
34
# Select Waveform Generation Mode, act_hwPWM_CHx_WGM
71
# Select Waveform Generation Mode, act_hwPWM_CHx_WGM
35
# See table datasheet for information
72
# See table datasheet for information
36
act_hwPWM_CH1_WGM=1
73
act_hwPWM_CH1_WGM=1
37
 
74
 
38
# Select Clock Prescaler, act_hwPWM_CHx_CS
75
# Select Clock Prescaler, act_hwPWM_CHx_CS
39
# 1 divide by 1    2 divide by 8
76
# 1 divide by 1    2 divide by 8
40
# 3 divide by 32   4 divide by 64
77
# 3 divide by 32   4 divide by 64
41
# 5 divide by 128  6 divide by 256
78
# 5 divide by 128  6 divide by 256
42
# 7 divide by 1024
79
# 7 divide by 1024
Line 49... Line 86...
49
#### PWM Channel 2, EXP_C, Timer1, OC1A ####
86
#### PWM Channel 2, EXP_C, Timer1, OC1A ####
50
act_hwPWM_CH2_COM=0
87
act_hwPWM_CH2_COM=0
51
act_hwPWM_CH2_WGM=1
88
act_hwPWM_CH2_WGM=1
52
act_hwPWM_CH2_CS=1
89
act_hwPWM_CH2_CS=1
53
act_hwPWM_CH3_LED=0
90
act_hwPWM_CH3_LED=0
-
 
91
 
-
 
92
#### PWM Channel 3 and 4 ####
-
 
93
# COM-modes:
-
 
94
#   In Fast PWM mode:
-
 
95
#     0 - Disabled
-
 
96
#     1 - Toggle output on compare match (if WGM >= 4)
-
 
97
#     2 - Clear output on Compare match, set at bottom (non-inverting)
-
 
98
#     3 - Set output on Compare match, clear at bottom (inverting)
-
 
99
#   In Phase correct mode:
-
 
100
#     0 - Disabled
-
 
101
#     1 - Toggle output on compare match (if WGM >= 4)
-
 
102
#     2 - Clear output on compare match when upcounting
-
 
103
#         set when downcounting
-
 
104
#     3 - Set output on compare match when upcounting
-
 
105
#         clear when downcounting
-
 
106
#
-
 
107
# WGM-modes:
-
 
108
#  Mode    "TOP"   "Update Output"  "Name"
-
 
109
#     0 -  0xFF      Immediate      Normal
-
 
110
#     1 -  0xFF         Top         PWM, Phase correct
-
 
111
#     2 -  0CRA      Immediate      CTC
-
 
112
#     3 -  0xFF        Bottom       PWM, Fast
-
 
113
#     4 -  Reserved
-
 
114
#     5 -  OCRA         Top         PWM, Phase correct
-
 
115
#     6 -  Reserved
-
 
116
#     7 -  OCRA        Bottom       PWM, Fast
54
 
117
 
55
#### PWM Channel 3, EXP_F, Timer0, OC0A ####
118
#### PWM Channel 3, EXP_F, Timer0, OC0A ####
56
act_hwPWM_CH3_COM=0
119
act_hwPWM_CH3_COM=0
57
act_hwPWM_CH3_WGM=1
120
act_hwPWM_CH3_WGM=1
58
act_hwPWM_CH3_CS=1
121
act_hwPWM_CH3_CS=1