Output ok, + choix canal pour Set_Impulse_Duration
This commit is contained in:
parent
5c38d5e1da
commit
6e1c2b1766
4 changed files with 49 additions and 39 deletions
|
@ -317,7 +317,7 @@
|
|||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGDARM</Key>
|
||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=98,107,519,534,0)(121=-1,-1,-1,-1,0)(122=674,103,1095,530,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=405,45,999,796,0)(131=-1,-1,-1,-1,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=504,37,1150,710,0)(110=60,88,280,548,0)(111=752,104,972,564,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=273,112,694,539,0)(121=75,104,496,531,0)(122=674,103,1095,530,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=709,11,1303,762,0)(131=150,13,744,764,0)(132=599,52,1193,803,0)(133=-1,-1,-1,-1,0)(160=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
@ -350,24 +350,7 @@
|
|||
<Name>-U-O142 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>42</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134221314</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>F:\Etudes\4A\µC - Périphériques\Periph-Voilier\Src\main.c</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\NUCLEO_F103RB\../Src/main.c\42</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<Breakpoint/>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
|
@ -379,7 +362,7 @@
|
|||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>0</SubType>
|
||||
<ItemText>0x080005D3</ItemText>
|
||||
<ItemText>0x04010001</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
|
@ -428,8 +411,13 @@
|
|||
<LogicAnalyzers>
|
||||
<Wi>
|
||||
<IntNumber>0</IntNumber>
|
||||
<FirstString>((porta & 0x00000100) >> 8 & 0x100) >> 8</FirstString>
|
||||
<SecondString>FF000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303031303029203E3E2038000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000F03F1600000000000000000000000000000000000000040C0008</SecondString>
|
||||
<FirstString>((porta & 0x00000080) >> 7 & 0x80) >> 7</FirstString>
|
||||
<SecondString>00800000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274612026203078303030303030383029203E3E2037000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F1800000000000000000000000000000000000000540E0008</SecondString>
|
||||
</Wi>
|
||||
<Wi>
|
||||
<IntNumber>1</IntNumber>
|
||||
<FirstString>((portb & 0x00000200) >> 9 & 0x200) >> 9</FirstString>
|
||||
<SecondString>00000000000000000000000000000000E0FFEF400100000000000000000000000000000028706F7274622026203078303030303032303029203E3E2039000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F1800000000000000000000000000000000000000540E0008</SecondString>
|
||||
</Wi>
|
||||
</LogicAnalyzers>
|
||||
<DebugDescription>
|
||||
|
|
|
@ -47,9 +47,12 @@ void MyPWM_Conf_Input(TIM_TypeDef * Timer, int channel1, int channel2)
|
|||
}
|
||||
|
||||
|
||||
void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, int Percentage)
|
||||
void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, int Percentage, int channel)
|
||||
{
|
||||
uint32_t CompareValue = 0xFFFF * Percentage/100;
|
||||
LL_TIM_OC_SetCompareCH1(Timer, CompareValue);
|
||||
if (channel==LL_TIM_CHANNEL_CH1) LL_TIM_OC_SetCompareCH1(Timer, CompareValue);
|
||||
else if (channel==LL_TIM_CHANNEL_CH2) LL_TIM_OC_SetCompareCH2(Timer, CompareValue);
|
||||
else if (channel==LL_TIM_CHANNEL_CH3) LL_TIM_OC_SetCompareCH3(Timer, CompareValue);
|
||||
else LL_TIM_OC_SetCompareCH4(Timer, CompareValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,4 +6,4 @@ void MyPWM_Conf_Output(TIM_TypeDef * Timer, int channel);
|
|||
|
||||
void MyPWM_Conf_Input(TIM_TypeDef * Timer, int channel1, int channel2);
|
||||
|
||||
void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, int Percentage);
|
||||
void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, int Percentage, int channel);
|
||||
|
|
47
Src/main.c
47
Src/main.c
|
@ -39,24 +39,43 @@ int main(void)
|
|||
/* Configure the system clock to 72 MHz */
|
||||
SystemClock_Config();
|
||||
|
||||
MyTimer_Conf(TIM1,999, 719);
|
||||
/*===Test Output===*/
|
||||
|
||||
MyPWM_Conf_Output(TIM1, LL_TIM_CHANNEL_CH1);
|
||||
TIM_TypeDef *Timer1 = TIM3;
|
||||
int Channel1 = LL_TIM_CHANNEL_CH2;
|
||||
TIM_TypeDef *Timer2 = TIM4;
|
||||
int Channel2 = LL_TIM_CHANNEL_CH4;
|
||||
|
||||
MyPWM_Set_Impulse_Duration(TIM1, 25);
|
||||
MyTimer_Conf(Timer1,0xFFFE, 0x72);
|
||||
MyTimer_Conf(Timer2,0xFFFE, 0x72);
|
||||
|
||||
MyPWM_Conf_Output(Timer1, Channel1);
|
||||
MyPWM_Conf_Output(Timer2, Channel2);
|
||||
|
||||
MyPWM_Set_Impulse_Duration(Timer1, 25, Channel1);
|
||||
MyPWM_Set_Impulse_Duration(Timer2, 75, Channel2);
|
||||
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||
LL_GPIO_InitTypeDef My_GPIO_Init_Struct;
|
||||
My_GPIO_Init_Struct.Pin = LL_GPIO_PIN_7;
|
||||
My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
My_GPIO_Init_Struct.Speed = LL_GPIO_MODE_OUTPUT_2MHz;
|
||||
My_GPIO_Init_Struct.Pull = LL_GPIO_PULL_DOWN;
|
||||
LL_GPIO_Init(GPIOA, &My_GPIO_Init_Struct);
|
||||
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
|
||||
My_GPIO_Init_Struct.Pin = LL_GPIO_PIN_9;
|
||||
My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
My_GPIO_Init_Struct.Speed = LL_GPIO_MODE_OUTPUT_2MHz;
|
||||
My_GPIO_Init_Struct.Pull = LL_GPIO_PULL_DOWN;
|
||||
LL_GPIO_Init(GPIOB, &My_GPIO_Init_Struct);
|
||||
|
||||
MyTimer_Start(Timer1);
|
||||
MyTimer_Start(Timer2);
|
||||
|
||||
// LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||
// GPIO_TypeDef * GPIO;
|
||||
// LL_GPIO_InitTypeDef My_GPIO_Init_Struct;
|
||||
// GPIO = GPIOA;
|
||||
// My_GPIO_Init_Struct.Pin = LL_GPIO_PIN_8;
|
||||
// My_GPIO_Init_Struct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||
// My_GPIO_Init_Struct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
// My_GPIO_Init_Struct.Speed = LL_GPIO_MODE_OUTPUT_10MHz;
|
||||
// My_GPIO_Init_Struct.Pull = LL_GPIO_PULL_DOWN;
|
||||
// LL_GPIO_Init(GPIO, &My_GPIO_Init_Struct);
|
||||
|
||||
MyTimer_Start(TIM1);
|
||||
|
||||
/* Infinite loop */
|
||||
while (1)
|
||||
|
|
Loading…
Reference in a new issue