pjs9115916 发表于 2011-6-21 00:00:40

请问马老师

请问马老师 我用proteus仿真1602的时候用您书上写的那个去仿真,电路图是用4路数据的也就是DB4到DB7为什么仿真不出来内容呢程序就是用您给的那个郁闷啊会是什么原因呢

millwood0 发表于 2011-6-21 01:17:22

if you post the schematic + source code, we may be able to help you.

in general, the issues with lcds are related to initialization.

pjs9115916 发表于 2011-6-21 08:44:29

http://cache.amobbs.com/bbs_upload782111/files_41/ourdev_650686QEPZA9.jpg
(原文件名:T)~1XD3V)$MV(TXO@72O3UP.jpg)
this is the schematic
andthis is the source code

/*********************************************
File name         : Demo_6_9.c
Chip type         : ATmega16
Program type      : Application
Clock frequency   : 4.000000 MHz
Memory model      : Small
External SRAM size: 0
Data Stack size   : 256
*********************************************/
#include <mega16.h>
// Alphanumeric LCD Module functions
#asm
   .equ __lcd_port=0x15
#endasm
#include <lcd.h>

typedef unsigned char byte;

/* table for the user defined character */
flash byte char0={                // 天的字型
0b0011111,
0b0000100,
0b0000100,
0b0011111,
0b0000100,
0b0000100,
0b0001010,
0b0010001};
flash byte char1={                // 向的字型
0b0000100,
0b0001000,
0b0011111,
0b0010001,
0b0011111,
0b0011011,
0b0011111,
0b0010001};
flash byte char2={                // 上的字型
0b0000100,
0b0000100,
0b0000111,
0b0000100,
0b0000100,
0b0000100,
0b0000100,
0b0011111};

/* function used to define user characters */
void define_char(byte flash *pc,byte char_code)
{
        byte i,a;
        a=(char_code<<3) | 0x40;
        for (i=0; i<8; i++) lcd_write_byte(a++,*pc++);
}

void main(void)
{
        lcd_init(16);                        // initialize the LCD for 2 lines & 16 columns

        define_char(char0,0);// define user character 0
        define_char(char1,1);// define user character 1
        define_char(char2,2);// define user character 2
        lcd_clear();
        lcd_putsf("Demo_6_9.c");        // 第一行显示内容
        lcd_gotoxy(0,1);
        lcd_putsf("User define:");        // 第二行显示内容
        lcd_putchar(0);                          // 接在后面显示"天天向上"
        lcd_putchar(0);
        lcd_putchar(1);
        lcd_putchar(2);
        while (1);
}
       help help!!!!

pjs9115916 发表于 2011-6-21 08:48:24

不好意思是个小问题 发现了
页: [1]
查看完整版本: 请问马老师