commit d38775d60b442a882b812e0048a89f53d6512762 Author: Yohan Boujon Date: Thu Jan 20 19:53:59 2022 +0100 Init from 13/01/22. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a33eaf6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Project Settings +*.cywrk.* +*.cyprj.* + +# Generated assets +# folders +**/CortexM3 +**/Export +**/Generated_Source +**/codegentemp +**/Debug +**/Release +# files +*_timing.html +*.pdf +*.cycdx +*.cyfit +*.rpt +*.svd +*.log +*.zip \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cydwr b/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cydwr new file mode 100644 index 0000000..cce95df --- /dev/null +++ b/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cydwr @@ -0,0 +1,3498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cyprj b/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cyprj new file mode 100644 index 0000000..71fc80f --- /dev/null +++ b/ER3_Boujon_Chaupitre/ER3.cydsn/ER3.cyprj @@ -0,0 +1,1817 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/ER3.cydsn/TopDesign/TopDesign.cysch b/ER3_Boujon_Chaupitre/ER3.cydsn/TopDesign/TopDesign.cysch new file mode 100644 index 0000000..fef1866 Binary files /dev/null and b/ER3_Boujon_Chaupitre/ER3.cydsn/TopDesign/TopDesign.cysch differ diff --git a/ER3_Boujon_Chaupitre/ER3.cydsn/cyapicallbacks.h b/ER3_Boujon_Chaupitre/ER3.cydsn/cyapicallbacks.h new file mode 100644 index 0000000..67e50a8 --- /dev/null +++ b/ER3_Boujon_Chaupitre/ER3.cydsn/cyapicallbacks.h @@ -0,0 +1,21 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#ifndef CYAPICALLBACKS_H +#define CYAPICALLBACKS_H + + + /*Define your macro callbacks here */ + /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/ + + +#endif /* CYAPICALLBACKS_H */ +/* [] */ diff --git a/ER3_Boujon_Chaupitre/ER3.cydsn/main.c b/ER3_Boujon_Chaupitre/ER3.cydsn/main.c new file mode 100644 index 0000000..5a85385 --- /dev/null +++ b/ER3_Boujon_Chaupitre/ER3.cydsn/main.c @@ -0,0 +1,196 @@ +/******************************************************************************* +* File Name: main.c +* +* Version: 2.20 +* +* Description: +* This project demonstrates the UART transmission mechanism. +* Data is sent through serial port that is visible in the Hyperterminal and on +* the LCD. ASCII characters from 0x20 to 0x7F(Space to ~ ) that can be +* displayed through Hyperterminal/LCD at the same time Interrupt is triggered +* and incremented while sending. +* +******************************************************************************** +* Copyright 2012-2017, Cypress Semiconductor Corporation. All rights reserved. +* This software is owned by Cypress Semiconductor Corporation and is protected +* by and subject to worldwide patent and copyright laws and treaties. +* Therefore, you may use this software only as provided in the license agreement +* accompanying the software package from which you obtained this software. +* CYPRESS AND ITS SUPPLIERS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* WITH REGARD TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*******************************************************************************/ + +#include +#include +#include + +#define PERIODE 256 +void modulation_pwm(float alpha); +float getAngle(void); +void DAC_conv(float erreur); +char ADC_conv(void); +int signalCarre(int consigne,int flagTemp); +int signalTriangle(int consigne,int flagTemp); +int acquerir_position(void); +volatile unsigned char flag=0; + +CY_ISR_PROTO(int_3); + +CY_ISR(int_3) +{ + flag=1; + Timer_1_ReadStatusRegister(); +} + + +int main() +{ + CyGlobalIntEnable; + VDAC8_1_Start(); + ADC_SAR_1_Start(); + ADC_SAR_1_StartConvert(); + PWM_1_Start(); + UART_1_Start(); + Timer_1_Start(); + isr_3_StartEx(int_3); + + int angleConsigne=0,i=0,flagTemp=0,consigne=50; //consigne = 50 pour carre et 0 pour triangle + char anglaUART[10+1]; + // Kp = 0.1/27.7 -> mais adapte pour etre plus opti +0.001 + float Kp=0.00461,Ki=0.000075; + float pwm_val,erAngle,angleCool,erreur_integral=0; + + ////////////////////////////////////////////// + //////////////passage par 0/////////////////// + ////////////////////////////////////////////// + do + { + modulation_pwm(0.55); + }while(acquerir_position() == 0); + modulation_pwm(0.5); + QuadDec_1_Start(); + ////////////////////////////////////////////// + + for(;;) + { + + ////////////////////////////////////////////////// + //liaison UART -> enlever angleConsigne=consigne// + ////////////////////////////////////////////////// + if(UART_1_GetRxBufferSize()>0) + { + do{ + while(UART_1_GetRxBufferSize()==0); + anglaUART[i]=UART_1_GetChar(); + i++; + }while((anglaUART[i-1] != '\r') || (i==11)); + anglaUART[i]='\0'; + i=0; + //UART_1_PutString(anglaUART); //pour voir si l'UART fonctionne + //angleConsigne=atoi(anglaUART); + }; + ////////////////////////////////////////////////// + + + + ////////////////////////////////////////////////// + //////////////// Asservissement ////////////////// + ////////////////////////////////////////////////// + if(flag == 1) + { + flagTemp++; + angleCool=getAngle(); //On récupère l'angle + angleConsigne=consigne; //!// permet d'utiliser les signaux mais empeche putty de fonctionner //!// + erAngle=angleConsigne-angleCool; //calcul de l'erreur + erreur_integral=erAngle+erreur_integral; + DAC_conv(erAngle); //conversion analogique de cette erreur + pwm_val=(erAngle*Kp)+(erreur_integral*Ki)+0.5; //calcul du PWM pour asservissement + modulation_pwm(pwm_val); //PWM sorti sur les pins + + consigne = signalCarre(consigne,flagTemp); //mettre consigne = 50 + //consigne = signalTriangle(consigne,flagTemp); //mettre consigne = 0 + flag = 0; + } + /////////////////////////////////////////////////// + + + + /////////////////////////////////////////////////// + /////////// calcul jusqu'à 1 seconde ////////////// + /////////////////////////////////////////////////// + if(flagTemp > 100) + { + flagTemp=0; + } + /////////////////////////////////////////////////// + } +} + +void modulation_pwm(float alpha) +{ + uint16 value = alpha*PERIODE; + PWM_1_WriteCompare1(value); + PWM_1_WriteCompare2(value); +} + +float getAngle(void) +{ + int counter=QuadDec_1_GetCounter(); + float angle = counter*0.144; //0.144 = 360/2500 + return angle; +} + +void DAC_conv(float erreur) +{ + int ampli=1; //permet d'amplifier si lerreur nest pas observable + //erreur=abs(erreur); + if(erreur > 180) + { + erreur=180.0; + } + if(erreur < -180) + { + erreur = -180.0; + } + int erreur_set=(int)(erreur*ampli*0.71111111); //0.71111 = 255/360 +180 deg -> à 0 deg = +2V + VDAC8_1_SetValue(erreur_set+127); +} + +int signalCarre(int consigne,int flagTemp) //signal carre allant de 50 à -50 +{ + if(flagTemp == 100) + { + consigne = -consigne; + }; + return consigne; +} + +int signalTriangle(int consigne,int flagTemp) //signal triangle allant de 0 à 100 +{ + if(flagTemp > 0 && flagTemp <= 50) + { + consigne=consigne+4; + } + if(flagTemp > 50 && flagTemp <= 100) + { + consigne=consigne-4; + } + return consigne; +} + +int acquerir_position(void) +{ + int position=0; + position=ADC_SAR_1_GetResult16(); //On récupère l'angle à 0 + if(position == 1854) + { + return 1; + } + else + { + return 0; + } +} + +/* [] END OF FILE */ diff --git a/ER3_Boujon_Chaupitre/ER3_Boujon_Chaupitre.cywrk b/ER3_Boujon_Chaupitre/ER3_Boujon_Chaupitre.cywrk new file mode 100644 index 0000000..54b22bf --- /dev/null +++ b/ER3_Boujon_Chaupitre/ER3_Boujon_Chaupitre.cywrk @@ -0,0 +1,22 @@ + + + + + + + + + +.\ER3.cydsn\ER3.cyprj + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/TopDesign/TopDesign.cysch b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/TopDesign/TopDesign.cysch new file mode 100644 index 0000000..17fde34 Binary files /dev/null and b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/TopDesign/TopDesign.cysch differ diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01-000.cywrk b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01-000.cywrk new file mode 100644 index 0000000..e88712a --- /dev/null +++ b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01-000.cywrk @@ -0,0 +1,22 @@ + + + + + + + + + +.\UART_Tx01.cyprj + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cydwr b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cydwr new file mode 100644 index 0000000..a2822b2 --- /dev/null +++ b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cydwr @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cyprj b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cyprj new file mode 100644 index 0000000..3f57c23 --- /dev/null +++ b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/UART_Tx01.cyprj @@ -0,0 +1,807 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/cyapicallbacks.h b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/cyapicallbacks.h new file mode 100644 index 0000000..67e50a8 --- /dev/null +++ b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/cyapicallbacks.h @@ -0,0 +1,21 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#ifndef CYAPICALLBACKS_H +#define CYAPICALLBACKS_H + + + /*Define your macro callbacks here */ + /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/ + + +#endif /* CYAPICALLBACKS_H */ +/* [] */ diff --git a/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/main.c b/ER3_Boujon_Chaupitre/UART_Tx01.cydsn/main.c new file mode 100644 index 0000000..e69de29 diff --git a/PWM_test/PWM_test/PWM.cydsn/PWM.cydwr b/PWM_test/PWM_test/PWM.cydsn/PWM.cydwr new file mode 100644 index 0000000..aa8c057 --- /dev/null +++ b/PWM_test/PWM_test/PWM.cydsn/PWM.cydwr @@ -0,0 +1,3380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PWM_test/PWM_test/PWM.cydsn/PWM.cyprj b/PWM_test/PWM_test/PWM.cydsn/PWM.cyprj new file mode 100644 index 0000000..8907458 --- /dev/null +++ b/PWM_test/PWM_test/PWM.cydsn/PWM.cyprj @@ -0,0 +1,928 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PWM_test/PWM_test/PWM.cydsn/TopDesign/TopDesign.cysch b/PWM_test/PWM_test/PWM.cydsn/TopDesign/TopDesign.cysch new file mode 100644 index 0000000..afa3090 Binary files /dev/null and b/PWM_test/PWM_test/PWM.cydsn/TopDesign/TopDesign.cysch differ diff --git a/PWM_test/PWM_test/PWM.cydsn/cyapicallbacks.h b/PWM_test/PWM_test/PWM.cydsn/cyapicallbacks.h new file mode 100644 index 0000000..67e50a8 --- /dev/null +++ b/PWM_test/PWM_test/PWM.cydsn/cyapicallbacks.h @@ -0,0 +1,21 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#ifndef CYAPICALLBACKS_H +#define CYAPICALLBACKS_H + + + /*Define your macro callbacks here */ + /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/ + + +#endif /* CYAPICALLBACKS_H */ +/* [] */ diff --git a/PWM_test/PWM_test/PWM.cydsn/main.c b/PWM_test/PWM_test/PWM.cydsn/main.c new file mode 100644 index 0000000..ed3a093 --- /dev/null +++ b/PWM_test/PWM_test/PWM.cydsn/main.c @@ -0,0 +1,35 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#include "project.h" + +#define PERIODE 256 +void modulation_pwm(float alpha); + +int main(void) +{ + CyGlobalIntEnable; /* Enable global interrupts. */ + PWM_1_Start(); + + /* Place your initialization/startup code here (e.g. MyInst_Start()) */ + modulation_pwm(0); + for(;;) + { + + } +} + +void modulation_pwm(float alpha) +{ + uint16 value = alpha*PERIODE; + PWM_1_WriteCompare1(value); + PWM_1_WriteCompare2(value); +} \ No newline at end of file diff --git a/PWM_test/PWM_test/PWM_test.cywrk b/PWM_test/PWM_test/PWM_test.cywrk new file mode 100644 index 0000000..25c9e54 --- /dev/null +++ b/PWM_test/PWM_test/PWM_test.cywrk @@ -0,0 +1,22 @@ + + + + + + + + + +.\PWM.cydsn\PWM.cyprj + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5a73d1 --- /dev/null +++ b/README.md @@ -0,0 +1,86 @@ +# Asservissement de Position + +## Intro + - Programmable System on Chip + - L’idée de remplacer par du numérique + - Blocs VHDL et du code en C + +## Matériel Utilisé + - Différence entre Kitprog et PSoC 5LP + - Différence avec un FPGA classique -> mémoire flash/blocs analogiques + - PSoC 5LP CY8C5888LTI-LP097 + - Choix des Pins -> mode lock + - Topdesign.cysch -> blocs VHDL, pins + - main.c -> utiliser les fonctions des blocs + +## Prise en main PSoC + - pins 12.7 et 12.6 pour TX et RX + - LCD en mode 4 bits + diff des pins + - Utilisation de la datasheet + - UART 57.6 Kbauds + COM26 + +## Signal PWM + - Différence entre 5-0 = 5, 2.5 - 2.5 = 0, 0-5 = -5 + - Valeur moyenne captée par le moteur car alimenté à 3 MHz + - Compare mode less(-128) et mode greater(+128) -> Période de 255 + - Start permet d’initialiser comme ATMega16 + - WriteCompare1&2 -> change la valeur de comparaison sur 8 bits + - Alpha (0-1) converti avec la période (0-256) + - Ne pose aucun problème si alpha > 1 ou alpha < 1 + +## Acquisition de la position + - Deux trous décalés et avec une certaine résolution + - B en avance sur A -> incrémente, sinon décrémente + - Résolution 16 bits mais peut être mise à 32 bits + - Voir la valeur sur le mode debug pour convertir en angle + +## Calcul Erreur pour asservir + - Pour 27.7° nous augmentons de 0.1 alpha + - Il faut ajouter 0.5 car alpha ne peut pas être négatif + - 0.00461 paraît mieux + +## Envoi d’une consigne via UART + - Récupérer une suite de caractère dans un tableau + - Le convertir via la fonction atoi (iota faisant l’inverse) + - En mode debug tout fonctionnait + - La fonction getbuffersize permet de ne récupérer qu’à un certain moment + +## Affichage de l’erreur avec sortie analogique + - Au début idée d’avoir 360° = 4V et 0° = 0V -> abs + - 4V avec résolution de 16 mV/bit + - 255/360 bits/degrés + - Maintenant avec ampli + entre 180 et -180° -> ajout de +127 (comme +0.5) + +## Cadencement à 10ms sous interruption + - Avoir un Te plus bas pour faire un échantillonnage adapté + - Bloc timer qui interrupt toutes les 10ms + - Sortie isr_3 convertie en int grâce à PROTO + - Quand int_3 = 1 -> va dans la fonction, flag à 1 + - ReadStatusRegister remet certains bits à 0 quand appelée + - UART reste dans le while(1) + - Création d’une variable flagTemp pour compter 1s + +## Création d’échelon/rampe + - On commence avec une consigne de 50 + - Toutes les secondes on inverse la consigne + - On commence avec une consigne de 0 + - On incrémente jusqu’à 0.5s, on décrémente par la suite -> boucle + +## Erreur de traînage + - Permet de réduire l’erreur sur une réponse à une rampe + - Calcul de l’aire de l’erreur pour la réduire + - Réducteur Ki doit être bas à 10^-4 près + - Perturbe l’échelon car augmente très vite d’un coup -> dépassement + - Ki = 0.00002 + +## Passage par 0 + - Utilisation du capteur de position + - 12 bits -> résolution précise avec CAN à 18 KHz + - Mode free-running, mode Vdda = Vref*2 = 2.5 *2 = 5V + - Alimenté en 5V/0V + - 5V à 0V pour 360° à 0° + - On prend getresult16 car au-dessus de 12 + - 0° est obtenu a 1854 via le debug + - Création d’une fonction (bool non présent) + - Allume le quaddec quand à 0° + diff --git a/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cydwr b/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cydwr new file mode 100644 index 0000000..7ed365b --- /dev/null +++ b/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cydwr @@ -0,0 +1,3380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cyprj b/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cyprj new file mode 100644 index 0000000..3d35f64 --- /dev/null +++ b/Roue Codeuse/Roue Codeuse/Design01.cydsn/Design01.cyprj @@ -0,0 +1,949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Roue Codeuse/Roue Codeuse/Design01.cydsn/TopDesign/TopDesign.cysch b/Roue Codeuse/Roue Codeuse/Design01.cydsn/TopDesign/TopDesign.cysch new file mode 100644 index 0000000..d9fc5d2 Binary files /dev/null and b/Roue Codeuse/Roue Codeuse/Design01.cydsn/TopDesign/TopDesign.cysch differ diff --git a/Roue Codeuse/Roue Codeuse/Design01.cydsn/cyapicallbacks.h b/Roue Codeuse/Roue Codeuse/Design01.cydsn/cyapicallbacks.h new file mode 100644 index 0000000..67e50a8 --- /dev/null +++ b/Roue Codeuse/Roue Codeuse/Design01.cydsn/cyapicallbacks.h @@ -0,0 +1,21 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#ifndef CYAPICALLBACKS_H +#define CYAPICALLBACKS_H + + + /*Define your macro callbacks here */ + /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/ + + +#endif /* CYAPICALLBACKS_H */ +/* [] */ diff --git a/Roue Codeuse/Roue Codeuse/Design01.cydsn/main.c b/Roue Codeuse/Roue Codeuse/Design01.cydsn/main.c new file mode 100644 index 0000000..4ba1641 --- /dev/null +++ b/Roue Codeuse/Roue Codeuse/Design01.cydsn/main.c @@ -0,0 +1,37 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#include "project.h" +float getAngle(void); + +int main(void) +{ + CyGlobalIntEnable; /* Enable global interrupts. */ + + /* Place your initialization/startup code here (e.g. MyInst_Start()) */ + QuadDec_1_Start(); + volatile float angle; + for(;;) + { + angle=getAngle(); + /* Place your application code here. */ + } +} + +float getAngle(void) +{ + int counter=QuadDec_1_GetCounter(); + float angle = counter*0.144; + return angle; +} + + +/* [] END OF FILE */ diff --git a/Roue Codeuse/Roue Codeuse/Roue Codeuse.cywrk b/Roue Codeuse/Roue Codeuse/Roue Codeuse.cywrk new file mode 100644 index 0000000..676cb68 --- /dev/null +++ b/Roue Codeuse/Roue Codeuse/Roue Codeuse.cywrk @@ -0,0 +1,22 @@ + + + + + + + + + +.\Design01.cydsn\Design01.cyprj + + + + + + + + + + + + \ No newline at end of file diff --git a/onsaitjamais.txt b/onsaitjamais.txt new file mode 100644 index 0000000..0e50d76 --- /dev/null +++ b/onsaitjamais.txt @@ -0,0 +1,4 @@ +Vert -> VDD +Bleu -> GND +Jaune -> 2.0 -> quadA +Rouge -> 1.7 -> quadB \ No newline at end of file diff --git a/test/UART_Tx01/UART_Tx01.cydsn/TopDesign/TopDesign.cysch b/test/UART_Tx01/UART_Tx01.cydsn/TopDesign/TopDesign.cysch new file mode 100644 index 0000000..0d03af7 Binary files /dev/null and b/test/UART_Tx01/UART_Tx01.cydsn/TopDesign/TopDesign.cysch differ diff --git a/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cydwr b/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cydwr new file mode 100644 index 0000000..d9da005 --- /dev/null +++ b/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cydwr @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cyprj b/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cyprj new file mode 100644 index 0000000..098c617 --- /dev/null +++ b/test/UART_Tx01/UART_Tx01.cydsn/UART_Tx01.cyprj @@ -0,0 +1,1449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/UART_Tx01/UART_Tx01.cydsn/cyapicallbacks.h b/test/UART_Tx01/UART_Tx01.cydsn/cyapicallbacks.h new file mode 100644 index 0000000..67e50a8 --- /dev/null +++ b/test/UART_Tx01/UART_Tx01.cydsn/cyapicallbacks.h @@ -0,0 +1,21 @@ +/* ======================================== + * + * Copyright YOUR COMPANY, THE YEAR + * All Rights Reserved + * UNPUBLISHED, LICENSED SOFTWARE. + * + * CONFIDENTIAL AND PROPRIETARY INFORMATION + * WHICH IS THE PROPERTY OF your company. + * + * ======================================== +*/ +#ifndef CYAPICALLBACKS_H +#define CYAPICALLBACKS_H + + + /*Define your macro callbacks here */ + /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/ + + +#endif /* CYAPICALLBACKS_H */ +/* [] */ diff --git a/test/UART_Tx01/UART_Tx01.cydsn/main.c b/test/UART_Tx01/UART_Tx01.cydsn/main.c new file mode 100644 index 0000000..e8419f9 --- /dev/null +++ b/test/UART_Tx01/UART_Tx01.cydsn/main.c @@ -0,0 +1,65 @@ +/******************************************************************************* +* File Name: main.c +* +* Version: 2.20 +* +* Description: +* This project demonstrates the UART transmission mechanism. +* Data is sent through serial port that is visible in the Hyperterminal and on +* the LCD. ASCII characters from 0x20 to 0x7F(Space to ~ ) that can be +* displayed through Hyperterminal/LCD at the same time Interrupt is triggered +* and incremented while sending. +* +******************************************************************************** +* Copyright 2012-2017, Cypress Semiconductor Corporation. All rights reserved. +* This software is owned by Cypress Semiconductor Corporation and is protected +* by and subject to worldwide patent and copyright laws and treaties. +* Therefore, you may use this software only as provided in the license agreement +* accompanying the software package from which you obtained this software. +* CYPRESS AND ITS SUPPLIERS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +* WITH REGARD TO THIS SOFTWARE, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*******************************************************************************/ + +#include + +#define LCD_NUM_COLUMNS (16u) + + + +int main() +{ + uint8 ch; /* Data sent on the serial port */ + uint8 count = 0u; /* Initializing the count value */ + uint8 pos = 0u; + + + UART_1_Start(); /* Enabling the UART */ + LCD_Char_1_Start(); /* Enabling the LCD */ + LCD_Char_1_PrintString("bonjour"); + + while(1){ + if (UART_1_GetRxBufferSize()>0) { + ch=UART_1_GetChar(); + + count++; + if(count % LCD_NUM_COLUMNS == 0u) /* If the count value reaches the count 16 start from first location */ + { + pos = 0u; /* resets the count value */ + LCD_Char_1_WriteControl(LCD_Char_1_CLEAR_DISPLAY); /* Display will be cleared when reached count value 16 */ + } + + LCD_Char_1_Position(0u, pos++); /* LCD position to the count++ */ + LCD_Char_1_PutChar(ch); /* print the value in the LCD */ + + LCD_Char_1_Position(1u, 0u); + LCD_Char_1_PrintInt8(count); /* prints the count in the LCD */ + CyDelay(200u); + } + + } +} + + +/* [] END OF FILE */ + diff --git a/test/UART_Tx01/UART_Tx01.cywrk b/test/UART_Tx01/UART_Tx01.cywrk new file mode 100644 index 0000000..38b459d --- /dev/null +++ b/test/UART_Tx01/UART_Tx01.cywrk @@ -0,0 +1,22 @@ + + + + + + + + + +.\UART_Tx01.cydsn\UART_Tx01.cyprj + + + + + + + + + + + + \ No newline at end of file diff --git a/tests-integrateur.txt b/tests-integrateur.txt new file mode 100644 index 0000000..fe71d3d --- /dev/null +++ b/tests-integrateur.txt @@ -0,0 +1,15 @@ +0.0005 +0.0002 +0.00005 +0.00002 +0.000005 + +0.000005 +0.00002 +0.00005 +0.0002 +0.0005 + +0.00005 parait le plus opti, mais peut être amélioré ! +soit des tests plus precis : +0.000075 \ No newline at end of file