Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. // 3 Alimentation et réglage de la vitesse de l'hélice avec fonction
  2.  
  3. //--------------------------------------------------------------
  4. //INCLUDES
  5. //--------------------------------------------------------------//
  6.  
  7. #include <p33FJ256GP710.h>
  8. #include "CNAserie.h"
  9. #include "son.h"
  10. #include "lcd.h"
  11. #include "init.h"
  12. #include "clav.h"
  13. #include <math.h>
  14.  
  15. //--------------------------------------------------------------
  16. //VARIABLES GLOBALES
  17. //--------------------------------------------------------------//
  18.  
  19. void start(float rapportCyclique){
  20.  
  21. PR2 = 4000; // Voir notes
  22.  
  23. OC4CONbits.OCTSEL = 0; // Timer 2 is the clock for output compare
  24. OC4CONbits.OCM = 0b110; // PWM mode without fault protection
  25. OC4R = 0; // Pour commencer à 0 sur le graphe (voir notes)
  26. OC4RS = 4000*rapportCyclique; // Voir notes pour 1600. Permet de régler la vitesse.
  27.  
  28. T2CONbits.TON = 1; // Lance le timer 2
  29. }
  30.  
  31. int main(void) {
  32. //--------------------------------------------------------------
  33. //Définitions de vos variables
  34. //--------------------------------------------------------------
  35.  
  36. //--------------------------------------------------------------
  37. //INITIALISATION DE LA CARTE
  38. //--------------------------------------------------------------
  39. init();
  40.  
  41. Init_LCD();
  42. //--------------------------------------------------------------
  43. //ECRIRE ICI VOTRE CODE D'INITIALISATION DES PERIPHERIQUES
  44. //--------------------------------------------------------------//
  45.  
  46. start(0.4);
  47.  
  48. while (1) {
  49. //--------------------------------------------------------------
  50. //ROUTINE PRINCIPALE DU PROGRAMME
  51. //--------------------------------------------------------------//
  52. //----------------------------------
  53. //Fonction longue permettant d'écrire sur le LCD, laisser en commentaire sauf demande contraire dans l'énoncé
  54. //----------------------------------
  55. //clav2LCD();
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement