Hi there! I am using the evaluation version (4k) of the C51 compiler with a Cypress CY7C64603 device. I am trying to use the GPIF section of this device using a set of variables stored as: const char xdata WaveDesc[128]={...}; When I store this many constants in xdata the code does not run; there are no errors during compilation, it just doesnt work. I know the values I am using are correct, as I have implemented the initialisation of the GPIF using an un-rolled version and it works correcly ie:- Dest++ = 0x00; Dest++ = 0x00; ... Dest++ = 0x00; rather than the much more compact for(x=0; x<128; x++){ Dest++ = Source++; } where Source is a pointer to a char in WaveDesc and Dest points to the appropriate register. I have also determined that it is definatly to do with the amount of constants in memory, as a piece of code which works without it does not work if the array is defined, even though the code does not use the array. The code and values are produce by the Cypress GPIF tool, so they should be correct (they look OK to me). I have found that any array greater than 16 digits in length will stop it working. Does anybody have any ideas as to what is going wrong? I dont entirly understand the memory structure of this device yet so it could well be somthing simple, but I cant see it! Thanks in advance Richard
What I am trying to achieve is the copying of a constant array of 128 characters, to 128 consecutive registers in external data space. The example given uses the following form:-
const char xdata Wave_Data[128] = {0xFF, ..., 0x00}; unsigned char xdata *Dest; ussigned char xdata *Source; Source = WaveData; // Transfer the GPIF Tool generated data Dest = &WFDESC[0]; for (x = 0; x < 128; x++) *Dest++ = *Source++;
WFDESC[0] = 0xFF; . . . WFDESC[127] = 0x00;
const char xdata Wave1[] = {0x0F,0x17,0x1F,0x27,0x2F,0x37,0x3F,0x07}; const char xdata Wave2[] = {0x00,0x09,0x12,0x1B,0x24,0x2D,0x36,0x3F}; Dest = &WFDESC[0]; for(y = 0; y < 2; y++){ Source = &Wave1[0]; for (x = 0; x < 8; x++) *Dest++ = *Source++; for (x = 0; x < 8; x++) *Dest++ = 0x00; for (x = 0; x < 8; x++) *Dest++ = 0xFF; Source = &Wave2[0]; for (x = 0; x < 8; x++) *Dest++ = *Source++; } // there is more, but this gives the idea WFDESC[66] = 0x04; WFDESC[71] = 0x07; WFDESC[74] = 0x02;
printf("0xbb trying to make this work");
Have you examined the generated assembler? Could there be a timing issue here? "I believe code and data share the same physical RAM address's [sic] so there must be no overlap- any clarification on this point would be appreciated)" The 8051 has separate code & data address spaces.