deltatech
Joined: 22 Apr 2006 Posts: 87
|
External Memory Read not working |
Posted: Fri Jun 30, 2006 12:10 pm |
|
|
Hi Can any one tell me what’s wrong here. I want to write Table one to external memory . At addresses in Table two But when I read after writing I am always getting back 59 .
Thanks in advance
Quote: | \0A06/30/2006 19:03:52.802 --> Read or Write: R\0D
\0A06/30/2006 19:03:53.802 --> MONTH_INDEX: 01 59\0D
\0A\0D
\0A06/30/2006 19:03:53.833 --> MONTH_INDEX: 02 59\0D
\0A\0D
\0A06/30/2006 19:03:53.849 --> MONTH_INDEX: 03 59\0D
\0A\0D
\0A06/30/2006 19:03:53.880 --> MONTH_INDEX: 04 59\0D
\0A\0D
\0A06/30/2006 19:03:53.896 --> MONTH_INDEX: 05 59\0D
\0A\0D
\0A06/30/2006 19:03:53.927 --> MONTH_INDEX: 06 59\0D
\0A\0D
\0A06/30/2006 19:03:53.943 --> MONTH_INDEX: 06 59\0D
\0A\0D
\0A06/30/2006 19:03:53.958 --> MONTH_INDEX: 07 59\0D
\0A\0D
\0A06/30/2006 19:03:53.990 --> MONTH_INDEX: 08 59\0D
\0A\0D
\0A06/30/2006 19:03:54.021 --> MONTH_INDEX: 09 59\0D
\0A\0D
\0A06/30/2006 19:03:54.037 --> MONTH_INDEX: 0A 59\0D
\0A\0D
\0A06/30/2006 19:03:54.052 --> MONTH_INDEX: 0B 59\0D
\0A\0D
06/30/2006 19:03:54.083 --> Read or Write: |
Code: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <input.c>
#include <pcf8570.c>
const char const ONE=20;
const char const TWO=13;
const char const TABLE[ONE]={5,2,6,3,4,5,0,0,3,3,3,28,25,21,19,16,14,12,10,89};
const char const MONTH_INDEX[TWO]={1,2,3,4,5,6,6,7,8,9,10,11,12};
void main() {
int j,i,k;
BYTE value,cmd;
BYTE MONTH;
do {
do {
printf("\r\nRead or Write: ");
cmd=getc();
cmd=toupper(cmd);
putc(cmd);
} while ( (cmd!='R') && (cmd!='W') );
MONTH = MONTH_INDEX[j];
if(cmd=='R')
{
for (j=0;j<12;j++)
{
MONTH = MONTH_INDEX[j];
printf("\r\nMONTH_INDEX: %X %X\r\n",MONTH,READ_EXT_SRAM( MONTH ) );
}
}
if(cmd=='W')
{
for (j=0;j<12;j++)
{
MONTH = MONTH_INDEX[j];
for(i=0;i<20;i++)
{value= TABLE[i];
WRITE_EXT_SRAM( MONTH, value );
}
}
}
} while (TRUE);
} |
|
|