<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">dobry den</div>
<div class="moz-cite-prefix">s STM32F030K6T6 jsem delal pro kamarada
nastavovani modelarskeho serva opakovacka 20 ms a pulz 1-2ms<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">void motor(char co)<br>
{<br>
unsigned int pwmx;<br>
switch (co) {<br>
case 'I':<br>
RCC_APB1ENR |=2; //servo
inicializace<br>
GPIOB_MODER |= 0x00000008; //port pb1<br>
GPIOB_AFRL |= 0x00000010;<br>
TIM3_CR1 = 0x1; <br>
TIM3_CCMR2_Output = 0x7000; <br>
TIM3_CCR4 = 0; //togle<br>
TIM3_CCER = 0x3000; //11<br>
TIM3_CNT = 0;<br>
TIM3_PSC = 7; //1us<br>
TIM3_ARR = 20000; //20ms<br>
TIM3_CR1 = 0x1; //43<br>
TIM3_CCR4 = 1000; //1.5ms<br>
break;<br>
case 'P':<br>
pwmx = servo * 50 + 1000; //servo nastaveni<br>
if (pwmx>2000) pwmx=2000; <br>
TIM3_CCR4 = pwmx;<br>
break;<br>
case 'S':TIM3_CCR4 = 1000; //1.5ms servo stop<br>
break;<br>
}<br>
}<br>
<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
jeste priklad pro stm32f446 - <br>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">#define enc1 0 //pc7 T3ch2<br>
#define enc2 0 //pc8 T3ch3<br>
<br>
void encod(unsigned char co){<br>
if (co=='I')
{
//inicializace<br>
GPIOC_MODER &= 0xfffc3fff;<br>
GPIOC_MODER |= 0x00028000;<br>
GPIOC_AFRH |= 0x00000002;<br>
GPIOC_AFRL |= 0x20000000;<br>
GPIOC_OSPEEDR |=0x00028000;<br>
RCC_APB1ENR |= 0x2; //tim3 168/4 42MHz<br>
TIM3_CR1 = 0x81; <br>
TIM3_CCMR1_Output = 0x7000; <br>
TIM3_CCMR2_Output = 0x0070; <br>
TIM3_CCER = 0x0110; <br>
TIM3_CNT = 0;<br>
TIM3_PSC = 0;<br>
TIM3_ARR = 20000;<br>
TIM3_CCR2 = 10000;<br>
TIM3_CCR3 = 10000;<br>
TIM3_CR1 = 0x81; //zisk ad603 pwm1 ch1<br>
}<br>
<br>
if (co=='P')
{ //nastaveni<br>
<br>
if (laserA>18000) pwmx=18000; else pwmx=18000 -
laserA;<br>
TIM1_CCR2 = pwmx;<br>
if (laserB>18000) pwmx=18000; else pwmx=18000 -
laserB;<br>
TIM1_CCR3 = pwmx;<br>
}<br>
}</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">mam tady jeste priklad pro stm32f427 -
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">//#define laspwm 0x200
//d14 T4ch3<br>
//#define pwina // d12 T4ch1 //zisk<br>
//#define pwin // d13 T4ch2<br>
<br>
</div>
<div class="moz-cite-prefix">unsigned int laseron ;<br>
void laser(unsigned char co)<br>
{<br>
signed int laspoz;<br>
switch (co) {<br>
case 'I':<br>
GPIOD_MODER &= 0xc0FFFFFF;<br>
GPIOD_MODER |= 0x2a000000;<br>
GPIOD_AFRH |= 0x02220000;<br>
RCC_APB1ENR |= 0x4;<br>
TIM4_CR1 = 0x1;<br>
TIM4_CCMR2_Output = 0x70;<br>
TIM4_CCMR1_Output = 0x7070;<br>
TIM4_CCER = 0x0111; //11<br>
TIM4_CNT = 0;<br>
TIM4_PSC = 10;<br>
TIM4_ARR = 256;<br>
TIM4_CCR3 = 255;<br>
TIM4_CR1 = 0x1; //zisk ad603 pwm1 ch1
unsigned int lasset,lasproud,maxlaser;<br>
break;<br>
case 'P':<br>
TIM4_CCR3 = laserproud;</div>
<div class="moz-cite-prefix"> TIM4_CCR2 = zisk;<br>
TIM4_CCR1 = ziska;<br>
break;<br>
}<br>
}<br>
<br>
fanda<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Dne 29. 11. 2020 v 11:15 Pavel Hudecek
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:8i.Dy3Cu.cFAfCNqgN4.1VmtIy@seznam.cz">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal">Dobrý den všem,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Trápím se tady s STM32F030K6T6, k PC
připojeno přes STM32F0308 discovery, Cube IDE.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">1. Jak udělat, aby program běžel i po
disconnect?</p>
<p class="MsoNormal">2. Nedaří se mi zprovoznit PWM. Byla by
nějaká ukázka, nejlépe pro TIM3?</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Díky,</p>
<p class="MsoNormal">PH</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>