#define PC_0 PORTC0
#ifndef LCD_H
#define LCD_H
#include "iom64v.h"
#define PC_0 PORTC0
#define PC_1 PORTC1
#define PC_2 PORTC2
#define LCD_CS1 PORTC3
#define LCD_CS2 PORTC4
#define LCD_RD PORTC5
#define LCD_WR PORTC6
#define LCD_DATA PORTC7
#define uint unsigned int
#define uchar unsigned char
extern uint cuont;
extern void Delay_1ms (unsigned int cuont);
#endif
#include "iom64v.h"
#include "LCD.H"
//主控单片机型号Atmega64;
//晶振:内部晶振8MHz,程序烧写时选择合适的选项;
//时钟周期: T1=1/fosc=1/(8*10M);
uint cuont;
//延时1ms函数;
void Delay_1ms (uint cuont) //cuont=200,Delay=200ms
{
uint j;
for(;cuont>0;cuont--)
{
for(j=8000;j>0;j--)
{;}
}
}
//延时200ms;
void LCD(void)
{
Delay_1ms(200);
//CTLPORTC=0x00;
}
//LCD模块初始化;
void Init_LCD(void)
{
uint i;
Delay_1ms(200);
LCD_CS1=PORTC|(1<<5);
for(i=0;i<=8;i++)
{
LCD_DATA=0x01&((i+4)<<0x04);
LCD_CS1=0;
LCD_CS1=1;
}
for(i=0;i<=8;i++)
{
LCD_DATA=0x01&(i<<0x18);
LCD_CS1=0;
LCD_CS1=1;
}
}
以上是我写的LED初始化程序,不知道为什么编译时以下语句总提示“\LCD.c(34): lvalue required”这个错误,请各位高手指教!,我的编译器是ICC avr,芯片是atmega64.
LCD_DATA=0x01&((i+4)<<0x04);
LCD_CS1=0;
LCD_CS1=1;
|