main.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * main.c
  3. *
  4. * Copyright 2024 dh33ex <dh33ex@riseup.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19. * MA 02110-1301, USA or visit <http://www.gnu.org/licenses/>.
  20. *
  21. *
  22. */
  23. #include <msp430g2553.h>
  24. #include "pcd8544_lcd.h"
  25. int main(void) {
  26. WDTCTL = WDTPW | WDTHOLD;
  27. /* use 1 MHz */
  28. if (CALBC1_1MHZ != 0xFF) {
  29. DCOCTL = 0;
  30. BCSCTL1 = CALBC1_1MHZ;
  31. DCOCTL = CALDCO_1MHZ;
  32. }
  33. PCD8544 disp;
  34. disp.rst = BIT0;
  35. disp.ss = BIT1;
  36. disp.dc = BIT2;
  37. disp.bl = BIT3;
  38. LCD_init(&disp);
  39. LCD_backlight(&disp, 1);
  40. LCD_clear(&disp);
  41. LCD_set_address(&disp, 0, 0);
  42. LCD_write(&disp, "test");
  43. while (1) {
  44. __delay_cycles(1000000);
  45. LCD_write(&disp, ".");
  46. }
  47. return 0;
  48. }