با سلام وخسته نباشید
من چند مدتی هست که کدویژنو دانلود کردم رو LCDگرافیکش کار می کنه یه مشکلی پیش اومده تابعی که برای عکس گذاشتن روی LCDهست ادرس عکسو بهش می دم اما روی LCDهیچی نمایش داده نمی شه
اینم برنامه (ممنون می شم که کمکم کنید)
من چند مدتی هست که کدویژنو دانلود کردم رو LCDگرافیکش کار می کنه یه مشکلی پیش اومده تابعی که برای عکس گذاشتن روی LCDهست ادرس عکسو بهش می دم اما روی LCDهیچی نمایش داده نمی شه
اینم برنامه (ممنون می شم که کمکم کنید)
کد:
#include <mega16.h>
#include <delay.h>
// Graphic LCD functions
#include <glcd.h>
// Font used for displaying text
// on the graphic LCD
#include <font5x7.h>
// Function used for reading image
// data from external memory
/*unsigned char read_ext_memory(GLCDMEMADDR_t addr)
{
unsigned char data;
// Place your code here
return data;
} */
// Function used for writing image
// data to external memory
/*void write_ext_memory(GLCDMEMADDR_t addr, unsigned char data)
{
// Place your code here
}*/
// Declare your global variables here
//flash unsigned char buffer[6]={0x7E, 0x11, 0x11, 0x11, 0x7E, 0x00};
flash unsigned char buffer[1024]={
0, 0, 0,192, 0, 0, 0, 0,192, 0, 0,128, 64, 64, 64, 64,
0, 0,128, 64, 64,128,128, 0, 0, 0, 0, 64,248, 68, 68, 4,
64, 64, 64,128, 0, 0, 0,192, 64, 64, 64, 64,128, 64, 64, 64,
64,128, 0,196, 0, 0,252, 0, 0,196, 0, 0, 0, 0, 64, 64,
64,128, 0, 0,128,128, 64, 0, 0, 0, 0, 0,128, 64, 64, 64,
64,192, 0, 0, 0,128, 64, 0,192, 64, 64, 64, 64,128, 64, 64,
64, 64,128, 0,252, 64, 64, 64,128, 0, 0, 0,128, 64, 64, 64,
128, 0, 0, 0,252, 0, 0,128, 64, 64, 64, 64, 0, 0, 0, 0,
0, 0, 0, 15, 16, 16, 16, 16, 31, 0, 0, 9, 18, 18, 12, 0,
0, 15, 18, 18, 18, 18, 11, 2, 0, 0, 0, 0, 31, 0, 0, 12,
18, 17, 17, 31, 0, 0, 0, 31, 0, 0, 0, 0, 31, 0, 0, 0,
0, 31, 0, 31, 0, 0, 31, 0, 0, 31, 0, 0, 0, 12, 18, 17,
17, 31, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 9, 18, 18, 12,
0,129,198, 56, 6, 1, 0, 0, 31, 0, 0, 0, 0, 31, 0, 0,
0, 0, 31, 0, 31, 16, 16, 16, 8, 7, 0, 0, 15, 16, 16, 16,
8, 7, 0, 0, 31, 0, 0, 9, 18, 18, 12, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,224,
240,240, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,240,248,248,240,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,224,160, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32,160,224, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,192,224,112, 48, 56,248,252,252,254,254,252,
249,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48,248,252,
252,252,248, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0,255, 0, 1, 2, 4,136,208, 96, 64, 64, 64, 64, 64, 64, 96,
208,136, 4, 2, 1, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 31, 31, 0, 0,252,255,255,255,255,199, 1,
3, 7, 6, 14, 12, 28, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,128,192,192,224,240,240,248,248,252,255,255,255,255,
254,252,248,248,240,240,224,192,192,128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0,255,255,
255,192,192,192,192,192,192,192,192, 0, 0, 0, 0, 0, 0, 0,
0, 31, 24, 28, 22, 19, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 17, 19, 22, 28, 24, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,192,248,255,127, 31, 7, 3, 7, 31,255,
254,248,192, 0, 0, 0, 0, 0, 0, 0, 0, 0,112,120,124, 62,
62, 63, 31, 31, 31, 15, 15, 15, 7, 7, 7, 3,255,255,255,255,
3, 3, 7, 7, 7, 15, 15, 15, 31, 31, 31, 63, 62, 62,124,120,
112, 0, 0, 0, 0, 0,128,240,252, 28, 6, 7, 3, 0, 31, 31,
31, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24,248,248,240,128, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16, 30, 31, 7, 1, 0, 0, 0, 0, 0, 0, 0,
7, 31, 31, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,255,255,127,255,
240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 3, 31, 62,248,240,192,128,128, 0, 0,
0, 0, 0, 0, 0, 0, 0,128,192,224,240,112, 7, 63,255,252,
224, 96, 96,112, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 1, 0, 0, 0, 0,
0, 1, 1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 3, 3,
6, 6, 6, 6, 7, 7, 3, 3, 3, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
void main(void)
{
// Declare your local variables here
// Graphic LCD initialization data
GLCDINIT_t glcd_init_data;
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
//PORTC=0x00;
DDRC=0xff;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=0xFFFF
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=0xFF
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// USART initialization
// USART disabled
UCSRB=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// ADC initialization
// ADC disabled
ADCSRA=0x00;
// SPI initialization
// SPI disabled
SPCR=0x00;
// TWI initialization
// TWI disabled
TWCR=0x00;
// Graphic LCD initialization
// The KS0108 connections are specified in the
// Project|Configure|C Compiler|Libraries|Graphic LCD menu:
// DB0 - PORTB Bit 0
// DB1 - PORTB Bit 1
// DB2 - PORTB Bit 2
// DB3 - PORTB Bit 3
// DB4 - PORTB Bit 4
// DB5 - PORTB Bit 5
// DB6 - PORTB Bit 6
// DB7 - PORTB Bit 7
// E - PORTD Bit 0
// RD /WR - PORTD Bit 1
// RS - PORTD Bit 2
// /RST - PORTD Bit 3
// CS1 - PORTD Bit 4
// CS2 - PORTD Bit 5
// Specify the current font for displaying text
glcd_init_data.font=font5x7;
// No function is used for reading
// image data from external memory
glcd_init_data.readxmem=NULL;
// No function is used for writing
// image data to external memory
glcd_init_data.writexmem=NULL;
glcd_init(&glcd_init_data);
glcd_clear();
while (1)
{
glcd_putimagef(0,0,buffer,GLCD_PUTNOT);
}
}





دیدگاه