Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/08/06 19:57
Read: times


 
#109553 - Keil example-- writing to 8051 mem----
Responding to: ???'s previous message
I continue studying Keil examples. I found one (generic_memwrite) in which they write in every type of memoory using the following instruction:

/*---------------------------------------------------------
Fill idata_buffer with something.
---------------------------------------------------------*/
memcpy (idata_buffer, "IDATA Buffer....", sizeof (idata_buffer));

unsigned char idata idata_buffer [16] _at_ 0xB0;
unsigned char data data_buffer [16] _at_ 0x60;
unsigned char pdata pdata_buffer [16] _at_ 0xFF60;
unsigned char xdata xdata_buffer [16] _at_ 0x0200;


/*---------------------------------------------------------
Fill data_buffer with something.
---------------------------------------------------------*/
memcpy (data_buffer, "DATA Buffer......", sizeof (data_buffer));

/*---------------------------------------------------------
Fill pdata_buffer with something.
---------------------------------------------------------*/
memcpy (pdata_buffer, "PDATA Buffer -- NEVER USE :-)", sizeof (pdata_buffer));

/*---------------------------------------------------------
Fill xdata_buffer with something.
---------------------------------------------------------*/
memcpy (xdata_buffer, "XDATA Buffer....", sizeof (xdata_buffer));



QUESTION: is MEMCPY a keil function? or is it ANSI?

In this example they do the following observation:

"The example program writes stuff into memory ONLY for demonstration purposes. You should not use this method of writing into memory in structured, high-level programming languages."

QUESTION: if thisway of writing works, whats wrong with using it?

List of 25 messages in thread
TopicAuthorDate
storing serial data in memory            01/01/70 00:00      
   after 100.000 writes it dies            01/01/70 00:00      
   if internal memory is the problem            01/01/70 00:00      
      Battery backed NVRAM from Dallas            01/01/70 00:00      
         he seems not to need permanent storage            01/01/70 00:00      
            not permanent storage            01/01/70 00:00      
               if the problem is pin shortage            01/01/70 00:00      
                  PCR8750            01/01/70 00:00      
   Keil example-- writing to 8051 mem----            01/01/70 00:00      
      nope            01/01/70 00:00      
         Not quite...            01/01/70 00:00      
      memcpy()            01/01/70 00:00      
         yes, ANSI, but not really '51            01/01/70 00:00      
            Rubbish!            01/01/70 00:00      
               Rubbish? I said "on the edge"            01/01/70 00:00      
         Not quite...            01/01/70 00:00      
            Very clever            01/01/70 00:00      
               indeed, if you have the time            01/01/70 00:00      
                  Do you know that?            01/01/70 00:00      
                     there is a large advantage when reading            01/01/70 00:00      
                        1 - 4 byte types supported            01/01/70 00:00      
         example link            01/01/70 00:00      
      Demo only            01/01/70 00:00      
         Grrr            01/01/70 00:00      
   i think this got a bit off track            01/01/70 00:00      

Back to Subject List