-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLista de configurações.txt
112 lines (86 loc) · 3.61 KB
/
Lista de configurações.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
##### Placa & Microcontrolador #####
Utilizando a placa de desenvolvimento popularmente conhecida como Blue Pill com o micrcontrolador STM32F103C8Tb
-> AS CONFIGURAÇÕES SE ENCONTRAM NO ARQUIVO COM FINAL ".ioc" <-
###### Configurações atuais #####
## System ##
DEBUG -> Serial Wire
## Clock ##
64MHz -> Máximo permitido para essa placa de desenvolvimento. É citado 72MHz mas não sei como ativar
## UART ##
UART 2:
-> Mode = Asynchronous
-> Hardware Flow Control (RS232) = Disable
Parameter Settings:
-> Baud Rate = 115200 Bits/s * Maior velocidade permitida pelo Xbee
-> Word Length = 8 bits *Padrão ASCII
-> Parity = None
-> Stop Bits = 1
-> Data Direction = Receive and Transmit
-> Over Sampling = 16 Samples *Padrão
Nota: As configurações DEVEM ser iguais as do Xbee para que a comunicação funcione adequadamente
## Timers ##
Timer 2:
-> Clock Sounce = Internal Clock
-> Channel 1 = PWM Generation CH1
-> Channel 2 = PWM Generation CH2
-> Deixar o resto desabilitado = Disable
NVIC Settings -> Não precisa ligar essa interrupção (Caixinha desmarcada)
Parameter Settings:
-> Prescaler = 0
-> Conter Mode = Up
-> Counter Period = 3199 (O programa soma 1 ao Prescaler e ao Counter Period)
-> Internal Clock Division = No Division
-> auto-reload preload = Disable
-> Master/Slave Mode = Disable
-> Tigger Event Selection = Reset
Chanel 1 e 2
-> Mode = PWM mode 1
-> Pulse = 0
-> Output compare prelaod = Disable
-> Fast mode = disable
-> CH Polarity = High
Notas:
Essa configuração faz com que a frequência do PWM seja de 20kHz (Clock/Counter Period = 64MHz/3200) e a resolução seja de 3200. Desse modo, 3200 = 100% de duty cycle, motor ligado no máximo, e 0 = completamente desligado.
Mais resolução permite um ajuste mais fino da velocidade do motor o que pode vir a ser necessário. Para aumentar a resolução é preciso aumentar o Counter Period. Mais resolução significa uma frequência menor e se ela for muito baixa o motor fica dando trancos.
Pense que o PWM é como apagar e acender a luz, se vc faz isso rápido o suficiente a sensação é que o brilho é um valor intermediário entre o totalmente claro e escuro. Se vc faz isso mt devagar então o resultado é que as vezes estará claro e as vezes escuro.
Timers 3 e 4:
-> Clock Sounce = Disable
-> Combined channels = Encoder Mode
-> Deixar o resto desabilitado = Disable
Parameter Settings:
-> Prescaler = 0
-> Conter Mode = Up
-> Counter Period = 59999 (O programa soma 1 ao Prescaler e ao Counter Period)
-> Internal Clock Division = No Division
-> auto-reload preload = Disable
-> Master/Slave Mode = Disable
-> Tigger Event Selection = Reset
Encoder:
-> Encoder Mode = Encoder Mode TI1 and TI2
Parameters for channel 1:
-> Polarity = Rising Edge
-> IC Selecntion = Direct
-> Prescaler Division Ratio = No division
-> Input filter = 0
Parameters for channel 2:
-> Polarity = Rising Edge
-> IC Selecntion = Direct
-> Prescaler Division Ratio = No division
-> Input filter = 0
## GPIO ##
PA0 (Led externo amarelo)-> Output. Label: Led_y
PA1(Led externo vermelho)-> Output. Label: Led_r
PB4 (Sentido A do motor 1) -> Output. Label: M1A
PB9 (Sentido B do motor 1) -> Output. Label: M1B
PB4 (Sentido A do motor 2) -> Output. Label: M2A
PB9 (Sentido B do motor 2) -> Output. Label: M2B
PC13 (LED interno) -> Output. Label: Led_i
PC15 (Led externo verde)-> Output. Label: Led_g
* A ponte H precisa de dois pinos para setar o sentido do motor
M1 M2 Giro
High Low Horário
Low High Anti-horário
Low Low Parado
High High Parado
## NVIC ##
Ativar interrupções globais do TIM2 e do USART2