/*in this hardware configuration, port2 is connected to the rows of an 8x5 LED array and the lower 3 bits of P1 /*is connected to a 3x8 decoder which controls the 5 columns of the array. in the software, character "A" is /*displayed on the LED array using pointer function. when the array containing the patterns of character "A" is /*placed in DATA memory, the program works perfectly well. the Irony is that when i tried to put the patterns in /*code memory, nonsensical results were obtained. Can anyone help me with this mess?*/ #include <REG52.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> /***********************************Global parameters***********************************/ unsigned char *DATA_POINTER; //unsigned char ARRAY_WIDTH; signed int start_horiz_pos; unsigned char char_pointer; /* first */ /* unsigned char code A[6] ={0x00,0x3F,0x50,0x90,0x50,0x3F}; */ /* second */ /*unsigned char code A[6] ={0x00,0x3F,0x50,0x90,0x50,0x3F}; */ main() { /***********************************functions*******************************************/ void delay (void); void DISP (unsigned char *DATA_POINTER); void EMERGE_FROM_LEFT (unsigned char [6]); /************************************variables******************************************/ unsigned char A[6]; /*=(0x00,0x3F,0x50,0x90,0x50,0x3F); */ /**************************************MAIN*********************************************/ A[0]=0x00; A[1]=0x3F; A[2]=0x50; A[3]=0x90; A[4]=0x50; A[5]=0x3F; while(1) { start_horiz_pos=0; DATA_POINTER=&A[0]; DISP(DATA_POINTER); // char_pointer=0; // EMERGE_FROM_LEFT(A); } } /*******************************************************************************************/ void delay (void) { unsigned char COUNTER; for ( COUNTER=0; COUNTER<1 ; COUNTER++) { TR0=0; TF0=0; TMOD=1; TL0=0x3C; TH0=0xF6; TR0=1; while(!TF0){} } } /*******************************************************************************************/ void DISP (unsigned char *DATA_POINTER) { signed char position; for( position = start_horiz_pos; position < start_horiz_pos+6; position++, DATA_POINTER++) { if (position >-1 && position < 6 ) /* ARRAY_WIDTH*/ { P2=*DATA_POINTER; P1=position-1; delay(); } } }