tuandanh.bk10
Trứng gà
em chào các anh chị, mấy bữa nay em đang làm cái mạch LCD đơn giản mà sao nạp code mãi không chạy, nó chỉ sáng đèn LCD với mấy cái ô đen đen thôi ạ em có kèm theo schematic và code LCD của lớp C8, mong anh chị xem giúp em( em đã add file lcd đầy đủ)
Code:
/******************************************************************************
*
* www.payitforward.edu.vn
*
*****************************************************************************/
/******************************************************************************
*
* PIF C8 COURSE
*
*****************************************************************************/
/******************************************************************************
*
* Module : LCD_main.c
* Description : LCD Example for C8
* Tool : CCS 5.1
* Chip : MSP430G2xxx
* History : 03-04-2013
* Version : 3.0
*
* Author : Nguyen Tien Manh, CLB NCKH DDT
* Notes :
*
*****************************************************************************/
/******************************************************************************
* IMPORT
*****************************************************************************/
#include <msp430.h>
#include "Basic_config.h"
#include "LCD.h"
/******************************************************************************
* EXTERN
*****************************************************************************/
/******************************************************************************
* GLOBAL VARIABLE
*****************************************************************************/
/******************************************************************************
* ROUTINES
*****************************************************************************/
/******************************************************************************
* MAIN
*****************************************************************************/
void main()
{
unsigned int val = 0;
Config_stop_WDT(); // stop WDT, see description in Basic_config.c
Config_Clocks();
P2SEL &= ~BIT6 + ~BIT7; // 2.6,2.7 are GPIO
P2SEL2 &= ~BIT6 + ~BIT7;
lcd_init (1); // init LCD, see description in LCD.c
lcd_backlight(1); // turn on LCD backlight
while (1)
{
lcd_clear (); // clear LCD
delay_ms (500); // delay 500ms
lcd_gotoxy(3,0); // move cursor
lcd_putc ('C');
lcd_gotoxy(3,1); // move cursor
lcd_puts ("Eight_");
lcd_put_num(val, 0, 0);
delay_ms (500); // delay 500ms
if (val++ == 9999) // check val and after that increase val
val = 0; // reset val
}
}
/******************************************************************************
* END OF LCD_main.c
*****************************************************************************/