We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello ALL, I'm new in c166 programming and sorry for my questions.. I have a next question about L166 locating... 1. for ex. one defines NDATA (04000h-07FFFh) NDATA0 (04000h-07FFFh) and i have for ex. global variable int a; will be this variable cleared to zero or not and how it is defined to which class it belongs? 2.one have the next user classes.. NDATA(0xC000-0xE7FF) SDATA (0XE000-0XE7FF, 0XF600-0XFDFF), IDATA (0XF600-0XFDFF) these declaration use the same memory area, how can one use it , would you give me some simple sample code to see the difference.(when one should use sdata and how in this case this variable is declared in the code). 3.Difference between ICODE and NCODE? 4.is there some good manuals about configuration of start167.a66 and L166 Locator? Thank you for any reply, With best regards, A
1. You can declare your global variable as static int a; - thus causes the compiler initialize it with 0 , if no other explicit value is assigned. Assuming the areas are right, it will belongs to NDATA0. "2.one have the next user classes.. NDATA(0xC000-0xE7FF) SDATA (0XE000-0XE7FF, 0XF600-0XFDFF), IDATA (0XF600-0XFDFF) these declaration use the same memory area, how can one use it , would you give me some simple sample code to see the difference.(when one should use sdata and how in this case this variable is declared in the code)." For variables you want to place in SDATA you should use the sdata keyword of compiler, e.g. unsigned char sdata var1; and the same for IDATA e.g. int idata var2=0x80; These keywords will force to place the variables in these areas. Where NCODE and NDATA are located, depends from memory modell and where your NDATA is located. It is described in L166 document more exactly. 3.Difference between ICODE and NCODE? ICODE = Internal CODE NCODE = Near CODE The area where your code is located. Stefan
Thank you very much! Stefan! if it's ok for you I would ask some more questions... 1. what is a default meaning of DPP0? For ex. if I would not define it in the locator. Something was sad about accessing to far objects and differences between C166 and C167/5?("In the C167/5, DPP0 is not used for far/huge/xhuge data accesses as the EXTx instructions are preferred"???) ? 2.Should I make some definitions for DPPx in the startup.a66 file or it's enough what I define in the Options/L166 locator? 3. Is there some discussion or example about using of RENAMECLASS directive where it's shown why one really needs this redifinition? 4.I'm still looking for the good description about start167.a66 setup? I should setup external buses in order to use external devices(rom,ram, etc...) Thanks, with best regards, A
1. DPP0 stands for Data Page Pointer 0 which addresses normally the first page inside a segment. If you read more about you will find that a segment is 64kB of memory size. Such a segment can be divided in pages of 16kB each. For addressing such a page you can use the DPP's. Normaly the DPP0 points to the system segment 0. How you can calculate I described in another thread, if you are interested in. What the standart access size is, that depends from the memory model, so that is related to your requirement of memory. It is quite sure not a fine hint, but that you have to read in the documentation of C166.pdf. 2. Where you make the assignments of the DPP's is equal, but I prefer, if I not change them inside the program to do this in Linker/Locator settings. 3. The #pragma renameclass is very good described with example in C166.pdf. You can use it, if you want to move your code inside the memory. With this pragma you can generate pieces of code you can control inside/with the Linker/Locator where you want to place it. The alarm.c - examples is quite good. I played with this and than it easy to understand. 4. Under µVision3 you can use the configuration wizard. Or if you are new with this stuff try DAvE (Infineons Code Generator) where you can produce a startup code and c-file templates in a graphical way. It is free of charge and you can download from Infineon WEB site. Hope this will help you. Stefan