Nalyd1002

lab1

Mar 19th, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. /* ========================================
  2. *
  3. * Copyright YOUR COMPANY, THE YEAR
  4. * All Rights Reserved
  5. * UNPUBLISHED, LICENSED SOFTWARE.
  6. *
  7. * CONFIDENTIAL AND PROPRIETARY INFORMATION
  8. * WHICH IS THE PROPERTY OF your company.
  9. *
  10. * ========================================
  11. */
  12. #include "project.h"
  13. #include "keyboard_keyboard.h"
  14.  
  15.  
  16. int COUNT=0;
  17.  
  18. void button(){
  19. if (SW1_Read()){
  20. LCD_ClearDisplay();
  21. LCD_Position(0,1);
  22. LED1_Write(1);
  23. CyDelay(500);
  24. COUNT += 1;
  25. LED1_Write(0);
  26. LCD_PrintNumber(COUNT);
  27.  
  28.  
  29. }
  30.  
  31.  
  32. }
  33.  
  34. void key(){
  35. keyboard_Start();
  36. if (keyboard_Scan()==49){
  37. LCD_ClearDisplay();
  38. LCD_PrintNumber(1);
  39. CyDelay(50);
  40. LCD_ClearDisplay();
  41.  
  42. }
  43.  
  44. }
  45.  
  46. void toggle()
  47. {
  48. GPIOJ11_Write(1);
  49. CyDelay(500);
  50. GPIOJ11_Write(0);
  51. CyDelay(50);
  52. GPIOJ12_Write(1);
  53. CyDelay(500);
  54. GPIOJ12_Write(0);
  55. CyDelay(500);
  56.  
  57.  
  58.  
  59. }
  60.  
  61.  
  62. int main(void)
  63. {
  64. CyGlobalIntEnable; /* Enable global interrupts. */
  65. LCD_Init();
  66. LCD_ClearDisplay();
  67. LCD_Position(0,1);
  68.  
  69.  
  70. /* Place your initialization/startup code here (e.g. MyInst_Start()) */
  71.  
  72. for(;;)
  73. {
  74. /* Place your application code here. */
  75. // button();
  76. // key();
  77. toggle();
  78.  
  79. }
  80. }
  81.  
  82. /* [] END OF FILE */
  83.  
Advertisement
Add Comment
Please, Sign In to add comment