main.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "hd44780_i2c_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. HD44780 disp;
  34. disp.light = 1;
  35. disp.cursor = HD44780_BLINK_CURSOR;
  36. disp.address = 0x27;
  37. disp.rows = 2;
  38. disp.columns = 16;
  39. LCD_init(&disp);
  40. LCD_clear(&disp);
  41. LCD_write(&disp, "test");
  42. while (1) {
  43. __delay_cycles(1000000);
  44. LCD_write(&disp, ".");
  45. }
  46. return 0;
  47. }