Advertisement
safwan092

Untitled

May 21st, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2. #include <project.h>
  3.  
  4. /* The LCD format in characters */
  5. #define LCD_ROWS (2u)
  6. #define LCD_COLUMNS (16u)
  7.  
  8. /* The delay between displaying bar graphs */
  9. #define BARGRAPH_DELAY_MS (15u)
  10.  
  11. int main()
  12. {
  13. uint8 row = 0u;
  14. uint8 column = 0u;
  15. uint8 length = 0u;
  16.  
  17. /* Start the LCD */
  18. LCD_Start();
  19.  
  20. /* Show the demo start message */
  21. LCD_Position(0u, 0u);
  22. LCD_PrintString("Horizontal BG");
  23. LCD_Position(1u, 0u);
  24. LCD_PrintString("Demo started");
  25. CyDelay(1000u);
  26.  
  27. /* Clear the LCD display */
  28. LCD_ClearDisplay();
  29.  
  30. /* Display the bar graph in each row of the LCD */
  31. for(row = 0u; row < LCD_ROWS; row++)
  32. {
  33. /* Display the bar graph from left to right with moving towards right */
  34. for(column = 0u; column <= LCD_COLUMNS; column++)
  35. {
  36. for(length = 0u; length < (LCD_CHARACTER_WIDTH * (LCD_COLUMNS - column)); length++)
  37. {
  38. LCD_DrawHorizontalBG(row, column, LCD_COLUMNS - column, length);
  39. CyDelay(BARGRAPH_DELAY_MS);
  40. }
  41.  
  42. /* Clear the display */
  43. LCD_ClearDisplay();
  44. }
  45. }
  46.  
  47. /* Wait for some time */
  48. CyDelay(500u);
  49.  
  50. /* Show the demo completion message */
  51. LCD_Position(0u, 0u);
  52. LCD_PrintString("Horizontal BG");
  53. LCD_Position(1u, 0u);
  54. LCD_PrintString("Demo completed");
  55.  
  56. for(;;)
  57. {
  58.  
  59. }
  60. }
  61.  
  62.  
  63. /* [] END OF FILE */
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement