khi mình debug msp430g2553 thì nó báo lỗi #10247-D creating output section ".stack" without a SECTIONS specification. MÌnh đã tìm nhiều hướng dẫn nhưng không có câu trả lời chính xác.Nếu bạn nào đã gặp và khắc phục đc thì trả lời giúp mình
đây là code test module LCD 16x2. viết trên CCS v5.3
#include <msp430g2553.h>
/*
* main.c
*/
#define LCD_Out P1OUT
#define LCD_Dir P1DIR
#define LCD_EN BIT0
#define LCD_RS BIT1
#define LCD_D4 BIT4
#define LCD_D5 BIT5
#define LCD_D6 BIT6
#define LCD_D7 BIT7
#define LCD_MASK (LCD_RS|LCD_EN|LCD_D4|LCD_D5|LCD_D6|LCD_D7)
#define TRUE 1
#define FALSE 0
void LCD_Enable(){
LCD_Out |= LCD_EN;
__delay_cycles(3);
LCD_Out &= ~LCD_EN;
__delay_cycles(50);
}
void LCD_SendByte(char Data,int isData){
LCD_Out &= ~LCD_MASK;
LCD_Out |= (Data & 0xF0);
if(isData==TRUE){
LCD_Out |= LCD_RS;
}
else{
LCD_Out &= ~LCD_RS;
}
LCD_Enable();
LCD_Out &= ~LCD_MASK;
LCD_Out |= ((Data<<4) & 0xF0);
if(isData==TRUE){
LCD_Out |= LCD_RS;
}
else{
LCD_Out &= ~LCD_RS;
}
LCD_Enable();
}
void LCD_Gotoxy(char Row,char Col){
char address;
if(!Col)
address = (0x80+Row);
else
address = (0xC0+Row);
LCD_SendByte(address,FALSE);
}
void LCD_Clear(){
LCD_SendByte(0x01,FALSE);
}
void LCD_Init(){
LCD_Dir |= LCD_MASK;
LCD_Out &= ~LCD_MASK;
__delay_cycles(200);
LCD_Out &= ~LCD_RS;
LCD_Out &= ~LCD_EN;
LCD_Out = 0x20;
LCD_Enable();
LCD_SendByte( 0x28,FALSE); // giao thuc 4 bit, hien thi 2 hang, ki tu 5x7
LCD_SendByte( 0x0C,FALSE); // cho phep hien thi man hinh
LCD_SendByte( 0x06,FALSE); // tang ID, khong dich khung hinh
LCD_Clear(); // xoa toan bo khung hinh
}
void LCD_Puts(char *s){
while(*s){
LCD_SendByte(*s,TRUE);
s++;
}
}
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
LCD_Init();
LCD_Clear();
while(1){
LCD_Gotoxy(0,1);
LCD_Puts("Hello");
__delay_cycles(2000);
}
}
đây là code test module LCD 16x2. viết trên CCS v5.3
#include <msp430g2553.h>
/*
* main.c
*/
#define LCD_Out P1OUT
#define LCD_Dir P1DIR
#define LCD_EN BIT0
#define LCD_RS BIT1
#define LCD_D4 BIT4
#define LCD_D5 BIT5
#define LCD_D6 BIT6
#define LCD_D7 BIT7
#define LCD_MASK (LCD_RS|LCD_EN|LCD_D4|LCD_D5|LCD_D6|LCD_D7)
#define TRUE 1
#define FALSE 0
void LCD_Enable(){
LCD_Out |= LCD_EN;
__delay_cycles(3);
LCD_Out &= ~LCD_EN;
__delay_cycles(50);
}
void LCD_SendByte(char Data,int isData){
LCD_Out &= ~LCD_MASK;
LCD_Out |= (Data & 0xF0);
if(isData==TRUE){
LCD_Out |= LCD_RS;
}
else{
LCD_Out &= ~LCD_RS;
}
LCD_Enable();
LCD_Out &= ~LCD_MASK;
LCD_Out |= ((Data<<4) & 0xF0);
if(isData==TRUE){
LCD_Out |= LCD_RS;
}
else{
LCD_Out &= ~LCD_RS;
}
LCD_Enable();
}
void LCD_Gotoxy(char Row,char Col){
char address;
if(!Col)
address = (0x80+Row);
else
address = (0xC0+Row);
LCD_SendByte(address,FALSE);
}
void LCD_Clear(){
LCD_SendByte(0x01,FALSE);
}
void LCD_Init(){
LCD_Dir |= LCD_MASK;
LCD_Out &= ~LCD_MASK;
__delay_cycles(200);
LCD_Out &= ~LCD_RS;
LCD_Out &= ~LCD_EN;
LCD_Out = 0x20;
LCD_Enable();
LCD_SendByte( 0x28,FALSE); // giao thuc 4 bit, hien thi 2 hang, ki tu 5x7
LCD_SendByte( 0x0C,FALSE); // cho phep hien thi man hinh
LCD_SendByte( 0x06,FALSE); // tang ID, khong dich khung hinh
LCD_Clear(); // xoa toan bo khung hinh
}
void LCD_Puts(char *s){
while(*s){
LCD_SendByte(*s,TRUE);
s++;
}
}
void main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
LCD_Init();
LCD_Clear();
while(1){
LCD_Gotoxy(0,1);
LCD_Puts("Hello");
__delay_cycles(2000);
}
}