Guest User

Untitled

a guest
Jul 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. /************************************************
  2. Si le message a, b, c ou d est reçu par UART,
  3. une des LEDs reliées à RA0, RA1, RA2 et RA3
  4. s'allume.
  5. MPLAB Xpress Evaluation Board
  6. *************************************************/
  7.  
  8.  
  9. #include "mcc_generated_files/mcc.h"
  10.  
  11.  
  12. void main(void)
  13. {
  14.  
  15. char message;
  16.  
  17. SYSTEM_Initialize();
  18.  
  19. while (1)
  20. {
  21. message = getch();
  22.  
  23. if (message == 'a') {
  24. IO_RA0_SetHigh();
  25. IO_RA1_SetLow();
  26. IO_RA2_SetLow();
  27. IO_RA3_SetLow();
  28. }
  29.  
  30. if (message == 'b') {
  31. IO_RA0_SetLow();
  32. IO_RA1_SetHigh();
  33. IO_RA2_SetLow();
  34. IO_RA3_SetLow();
  35. }
  36. if (message == 'c') {
  37. IO_RA0_SetLow();
  38. IO_RA1_SetLow();
  39. IO_RA2_SetHigh();
  40. IO_RA3_SetLow();
  41. }
  42. if (message == 'd') {
  43. IO_RA0_SetLow();
  44. IO_RA1_SetLow();
  45. IO_RA2_SetLow();
  46. IO_RA3_SetHigh();
  47. }
  48.  
  49. }
  50. }
Add Comment
Please, Sign In to add comment