ajout de seuils sur Duty_Cycle

This commit is contained in:
Neluji 2020-11-24 08:15:55 +01:00
parent 27c8c1a005
commit 5723b95405
3 changed files with 34 additions and 32 deletions

View file

@ -317,7 +317,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGDARM</Key> <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=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=533,85,954,512,0)(121=892,96,1313,523,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,17,1193,768,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=874,38,1295,465,0)(121=892,96,1313,523,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=521,17,1115,768,0)(131=150,13,744,764,0)(132=599,17,1193,768,0)(133=-1,-1,-1,-1,0)(160=674,53,1122,467,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>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@ -362,7 +362,7 @@
<Mm> <Mm>
<WinNumber>1</WinNumber> <WinNumber>1</WinNumber>
<SubType>0</SubType> <SubType>0</SubType>
<ItemText>porta</ItemText> <ItemText>0x08001778</ItemText>
<AccSizeX>0</AccSizeX> <AccSizeX>0</AccSizeX>
</Mm> </Mm>
</MemoryWindow1> </MemoryWindow1>
@ -374,7 +374,7 @@
<periodic>1</periodic> <periodic>1</periodic>
<aLwin>1</aLwin> <aLwin>1</aLwin>
<aCover>0</aCover> <aCover>0</aCover>
<aSer1>0</aSer1> <aSer1>1</aSer1>
<aSer2>0</aSer2> <aSer2>0</aSer2>
<aPa>0</aPa> <aPa>0</aPa>
<viewmode>1</viewmode> <viewmode>1</viewmode>
@ -411,13 +411,8 @@
<LogicAnalyzers> <LogicAnalyzers>
<Wi> <Wi>
<IntNumber>0</IntNumber> <IntNumber>0</IntNumber>
<FirstString>((portb &amp; 0x00000040) &gt;&gt; 6 &amp; 0x40) &gt;&gt; 6</FirstString> <FirstString>((porta &amp; 0x00000200) &gt;&gt; 9 &amp; 0x200) &gt;&gt; 9</FirstString>
<SecondString>00008000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274622026203078303030303030343029203E3E2036000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000001000000000000000000E03F0D00000000000000000000000000000000000000440E0008</SecondString> <SecondString>00008000000000000000000000000000E0FFEF400200000000000000000000000000000028706F7274612026203078303030303032303029203E3E2039000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000900000001000000000000000000F03F17000000000000000000000000000000000000003E160008</SecondString>
</Wi>
<Wi>
<IntNumber>1</IntNumber>
<FirstString>((portb &amp; 0x00000080) &gt;&gt; 7 &amp; 0x80) &gt;&gt; 7</FirstString>
<SecondString>00000000000000000000000000000000E0FFEF400000000000000000000000000000000028706F7274622026203078303030303030383029203E3E2037000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000002000000000000000000E03F0D00000000000000000000000000000000000000040E0008</SecondString>
</Wi> </Wi>
</LogicAnalyzers> </LogicAnalyzers>
<DebugDescription> <DebugDescription>

View file

@ -48,7 +48,7 @@ void MyRF_Conf(void) {
MyUSART_Conf(USARTOut, TransferDirTX); MyUSART_Conf(USARTOut, TransferDirTX);
//Configuration Timer (interruption à 3s, callback MyRF_Transmit_3s) et lancement //Configuration Timer (interruption à 3s, callback MyRF_Transmit_3s) et lancement
MyTimer_Conf(TimerRF,65633,3290); MyTimer_Conf(TimerRF,65533,3295);
MyTimer_IT_Conf(TimerRF,MyRF_Transmit_3s,3); MyTimer_IT_Conf(TimerRF,MyRF_Transmit_3s,3);
MyTimer_IT_Enable(TimerRF); MyTimer_IT_Enable(TimerRF);
MyTimer_Start(TimerRF); MyTimer_Start(TimerRF);
@ -56,21 +56,25 @@ void MyRF_Conf(void) {
} }
int MyRF_Input_Duty_Cycle(void) { int MyRF_Input_Duty_Cycle(void) {
int duty_cycle_RC = MyPWM_Duty_Cycle_Permilles(TimerCC, channelCC1, channelCC2);
return (MyPWM_Duty_Cycle_Permilles(TimerCC, channelCC1, channelCC2) - 75) * 4; if (74<duty_cycle_RC && duty_cycle_RC<77) {
return 0;
}
else {
return (duty_cycle_RC - 75) * 4;
}
} }
void MyRF_Transmit_3s(void) { void MyRF_Transmit_3s(void) {
//Récupérer : //Récupérer :
char bordage[3]; char bordage[3] = "";
char heure[2]; char heure[2] = "xx";
char min[2]; char min[2] = "xx";
char sec[2]; char sec[2] = "xx";
int allure_ref = 0; int allure_ref = 3;
char allure[7][30] = {"pas (ou vent debout).", char allure[7][16]= {"vent debout.",
"au plus près.", "au plus près.",
"au près.", "au près.",
"au bon plein.", "au bon plein.",
@ -78,8 +82,8 @@ void MyRF_Transmit_3s(void) {
"au grand largue.", "au grand largue.",
"au vent arrière." "au vent arrière."
}; };
char data1[23] = "\" : le voilier navigue "; char data1[14] = "\" - Bordage : ";
char data2[15] = " === Bordage : "; char data2[24] = " === Le voilier navigue ";
int i; int i;
@ -94,23 +98,23 @@ void MyRF_Transmit_3s(void) {
//Secondes //Secondes
MyUSART_Transmit_Data_8b(USARTOut, sec[0]); MyUSART_Transmit_Data_8b(USARTOut, sec[0]);
MyUSART_Transmit_Data_8b(USARTOut, sec[1]); MyUSART_Transmit_Data_8b(USARTOut, sec[1]);
//Texte 1 (allures) //Texte 1 (bordage)
for(i=0; i<23; i++) { for(i=0; i<14; i++) {
MyUSART_Transmit_Data_8b(USARTOut, data1[i]); MyUSART_Transmit_Data_8b(USARTOut, data1[i]);
} }
//Allure
for(i=0; i<30; i++) {
MyUSART_Transmit_Data_8b(USARTOut, allure[allure_ref][i]);
}
//Texte 2 (bordage)
for(i=0; i<15; i++) {
MyUSART_Transmit_Data_8b(USARTOut, data2[i]);
}
//Bordage //Bordage
for(i=0; i<3; i++) { for(i=0; i<3; i++) {
MyUSART_Transmit_Data_8b(USARTOut, bordage[i]); MyUSART_Transmit_Data_8b(USARTOut, bordage[i]);
} }
MyUSART_Transmit_Data_8b(USARTOut, '%'); MyUSART_Transmit_Data_8b(USARTOut, '%');
//Texte 2 (allure)
for(i=0; i<24; i++) {
MyUSART_Transmit_Data_8b(USARTOut, data2[i]);
}
//Allure
for(i=0; i<16; i++) {
MyUSART_Transmit_Data_8b(USARTOut, allure[allure_ref][i]);
}
//Newline (fin) //Newline (fin)
MyUSART_Transmit_Data_8b(USARTOut, '\n'); MyUSART_Transmit_Data_8b(USARTOut, '\n');

View file

@ -22,6 +22,7 @@
#include "stm32f1xx_ll_gpio.h" #include "stm32f1xx_ll_gpio.h"
#include "MyTimer.h" #include "MyTimer.h"
#include "MyPWM.h" #include "MyPWM.h"
#include "MyRF.h"
void SystemClock_Config(void); void SystemClock_Config(void);
@ -39,6 +40,8 @@ int main(void)
/* Configure the system clock to 72 MHz */ /* Configure the system clock to 72 MHz */
SystemClock_Config(); SystemClock_Config();
MyRF_Conf();
/* Infinite loop */ /* Infinite loop */
while (1) while (1)
{ {