Matt23

msp

Oct 25th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. #include<msp430x14x.h>
  2. #include "lcd.h"
  3. #include "portyLcd.h"
  4.  
  5. unsigned char i;
  6. unsigned char znak;
  7.  
  8. void initS() {
  9. SEND_CMD(0x40);
  10. int string[] = {0x2,0x4,0xe,0x10,0xe,0x1,0x1e,0x0};
  11. for (int i = 0; i < 8; i++)
  12. SEND_CHAR(string[i]);
  13. SEND_CMD(0x80);
  14. }
  15.  
  16. void initE() {
  17. SEND_CMD(0x40);
  18. int string[] = {0x0,0x0,0xe,0x11,0x1f,0x10,0xe,0x2};
  19. for (int i = 0; i < 8; i++)
  20. SEND_CHAR(string[i]);
  21. SEND_CMD(0x80);
  22. }
  23.  
  24. void printText() {
  25. char text[] = "Wszystkich witych";
  26. for (int i = 0; i < 17; i++) {
  27. if (i == 11) SEND_CHAR(0x00);
  28. if (i == 13) SEND_CHAR(0x01);
  29. SEND_CHAR(text[i]);
  30. }
  31. }
  32.  
  33. void main( void )
  34. { // STATUS LED
  35. WDTCTL=WDTPW + WDTHOLD; // zatrzymanie WDT
  36.  
  37. InitPortsLcd(); // inicjalizacja portów
  38. InitLCD(); // inicjalizacja LCD
  39. clearDisplay(); // czyszczenie LCD
  40.  
  41. initE();
  42. initS();
  43.  
  44. //SEND_CHAR(0x00);
  45. //SEND_CHAR(0x01);
  46.  
  47. printText();
  48.  
  49. while (1) // nieskończona pętla
  50. { // zmiana stanu diody na przeciwny
  51. //SEND_CMD(DATA_ROL_LEFT); // przesuwanie napisu w lewo
  52. for (int i = 0; i < 3; i++) {
  53. SEND_CMD(DATA_ROL_LEFT);
  54. Delayx100us(250);
  55. Delayx100us(250);
  56. Delayx100us(250);
  57. }
  58.  
  59. for (int i = 0; i < 3; i++) {
  60. SEND_CMD(DATA_ROL_RIGHT);
  61. Delayx100us(250);
  62. Delayx100us(250);
  63. Delayx100us(250);
  64. }
  65.  
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment