Haberler:

Foruma Resim Yükleme ve Boyut Sınırlaması ( ! )  https://bit.ly/2GMFb8H

Ana Menü

CCS C de pointer eksikliği..

Başlatan neotr, 09 Ocak 2009, 11:01:51

neotr

Merhaba arkadaşlar,
CCS de bır proje geliştirmekteyım fakat CCS C de CONST olan bir dizinin  adresini alamıyorum ve **p türünden (pointer to pointer ) turunde bır degısken yaratamıyorum
mesela...

//-----------------------------------------------------------
#include <stdio.h>
#include <conio.h>

const char deneme1[8]={"deneme1"};
const char deneme2[8]={"deneme2"};
const char deneme3[8]={"deneme3"};
const char deneme4[8]={"deneme4"};

const char *ptrdeneme[4]={&deneme1[0], .&deneme2[0], &deneme3[0], &deneme[0]};
void LcdPrint(const char **ptrfunc);

//-------------------------------------------------------------
//-------------------------------------------------------------
void main(void)
{
   LcdPrint(&deneme[0]);
   getch();
   
}
//-------------------------------------------------------------
//-------------------------------------------------------------
void LcdPrint(const char **ptrfunc)
{
   int i,j;
   
   for(i=0; i<4; i++)
      {
         for(j=0; j<8; j++)
         {
            printf("%c",*(ptrfunc+j));
         }   
         printf("\n");
      }   
}
//-------------------------------------------------------------
//-------------------------------------------------------------


Gibi bir işlemi CCS de nasıl gerçekleitirebileceğim hakkında fikir verebilirmisiniz.

mucit07

help de aradıgınız bilgi mevcut hocam

neotr

Üstad ben baktım fakat tam bulamadım yada beceremedım helpın bellı kısımlarına gırdım fakat ordakı bılgılerı denedım olmadı senın dedıgın kısım hangısıdır yardımcı olabılırmısın?

neotr

How can a constant data table be placed in ROM?

--------------------------------------------------------------------------------



The compiler has support for placing any data structure into the device ROM as a constant read-only element.  Since the ROM and RAM data paths are separate in the PIC®, there are restrictions on how the data is accessed.  For example, to place a 10 element BYTE array in ROM use:

BYTE CONST TABLE [10]= {9,8,7,6,5,4,3,2,1,0};



and to access the table use:

x = TABLE ;

OR

x = TABLE [5];



BUT NOT

ptr = &TABLE ;



In this case, a pointer to the table cannot be constructed.



Similar constructs using CONST may be used with any data type including structures, longs and floats.



Note that in the implementation of the above table, a function call is made when a table is accessed with a subscript that cannot be evaluated at compile time.


Benim Help te buldugum kısım bu mucit,
Bu durumu nasıl kotarırım arkadaşlar yardımcı olabilirmisiniz,,,