CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

External Memory Read not working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
deltatech



Joined: 22 Apr 2006
Posts: 87

View user's profile Send private message

External Memory Read not working
PostPosted: Fri Jun 30, 2006 12:10 pm     Reply with quote

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);

}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group