Design experience: How to ground in a multilayer PCB

1) C taboo absolute positioning. It is often seen that beginners require the use of _at_, which is a fallacy and treats C as ASM. The positioning of variables in C is a compiler thing. As long as the beginners define the scope of variables and variables, the compiler will give a fixed address to this variable. How to get the address of this variable? Use a pointer. For example, unsigned char data x; after x, the address of x is &x, you only need to look at this parameter, you can know the specific address in the program. So the first impression when you see someone who wants to use absolute positioning is that this is probably a beginner.

2) Set the SP problem. The reason is the same as 1 and the compiler automatically puts the start of the last byte as the starting position of the SP after all the variables and buffers are given addresses, so beginners do not need to pay attention to it. This reflects the superiority of C, and many things have been done during C compilation.

3) Use C's main program structure: #include void main(void) { while(1); } This is the smallest successful C program, including the header file and the program body. Explanation of the noun of the header file: The referenced external resource file, which contains the hardware information and descriptions of the functions and variables available from the external module. You can open reg52.h in text mode. If you study it carefully, there will be some experience in writing programs.

What are the common mistakes of the 51 single-chip structure C?

4) This constitutes a C project in C, commonly used projects to manage. Projects are generally divided into two major blocks: C file blocks and header file blocks. We often write different functions in different C files, according to the management of the * project, and finally connect all the files, so that you can get HEX files or BIN files that can be burned. Among these C files, there is only one and only the main() function, and the same C file as in 3). Use the header file to connect the different Cs to each other. A C file basically has to correspond to a H header file. This H file contains the variables and functions that can be used for external use in this C file. The files that are not listed in the H file are apologetic. Internal functions and variables that external C cannot use. Example: aC: unsigned char i; unsigned char mWork; void Test1(void) { mWork++; } void Test2(void) { i++; } ah file: extern unsigned char i; extern void Test1(void); Medium: #include /*C Compiler's own H file, use <>*/ #i nclude "ah" /* custom H file, generally use ""*/ void main(void) { Test1() ; / * Use the function in the ac module file * / while (1) { i + +; / * use the variables in the ac module file * / } }

5) The 51 family cores are based on 8031. There are a lot of extensions on this core. Some put the program memory inside: 89c(S)51.., and some added RAM: 89c(S)52.. Some have added some dedicated hardware 80C552..., and some have changed the clock timing W77E58.... Currently used in the market are ATMEL's AT89X series, PHILIPS' P87(89)x, Taiwan's WINBOND's w77(78)x series, and Cygnal's C8051Fx series.

6) C description of 51 single-chip structure The specific structure of 51 is not mentioned here, just to guide beginners to quickly understand the physical structure of 51 single-chip microcomputer. The address names of registers and IO and other hardware devices can be found in the corresponding C header file. 51 is reg51.h, 52 is reg52.h, and so on. For example, winbond's 78E58 is w78e58.h described in these H files: srf, defines an 8-bit device. Srf16, defines a 16-bit device. Sbit, a device that defines a bit. After defining these statements, you can use these hardware devices in C like assembly. This is where the microcontroller application is special than the standard C, and there are few other differences.

7) In the 51 series data, idata, xdata, pdata difference data: fixed refers to the front of 0x00-0x7f 128 RAM, can be directly read and written with acc, the fastest, the generated code is also the smallest. Idata: Fixed refers to the 256 RAMs in front of 0x00-0xff, where the first 128 and the 128 of the data are identical, just because the access is different. Idata is accessed using a pointer similar to C. The statement in the assembly is: mox ACC, @Rx. (not important addition: idata in pointer c has a good pointer access effect) xdata: external extension RAM, generally refers to the external 0x0000-0xffff space, accessed with DPTR. Pdata: The lower 256 bytes of the external expansion RAM. The address is read and written when it appears on A0-A7. It is read and written with movx ACC, @Rx. This is quite special, and C51 seems to have this bug, it is recommended to use less. But there are also his advantages, the specific usage belongs to the intermediate problem, not mentioned here.

8) The function of startup.a51 is the same as that of assembly. The initialization of those variables and arrays defined in C is performed in startup.a51. If you define a global variable with a value, such as unsigned char data xxx=100; There will be related assignments in startup.a51. If there is no =100, startup.a51 will clear him to 0. (startup.a51== initialization of variables). After these initializations are completed, the SP pointer is also set. For non-variable regions, such as the stack region, there will be no assignment or zeroing action. Some people like to change startup.a51. In order to satisfy some of their own hobbies, this is unnecessary and may be wrong. For example, when you want to save some variables when power-down protection is concerned, it is a very stupid way to change startup.a51. In fact, as long as you use the characteristics of the non-variable area, define a pointer variable to point to the lower part of the stack: 0xff. Why do you want to change it? It can be said: You don't need to change startup.a51 at any time, if you understand its characteristics.

0 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];

PA Ceiling Speaker

Hot selling Minsound series ceiling speakers produce clear and loud sound of high-fidelity in a wide coverage.

We have different models of ceiling speakers with different power ,speaker unit and size,

It is ideal choice for home theatre, meeting room, shopping mall, lecture room,classroom and so on.ceiling speaker


Ceiling Speaker,Ceiling Loudspeaker,in Ceiling Speaker,in Ceiling Speakers,Ceiling Mount Speakers

Taixing Minsheng Electronic Co.,Ltd. , https://www.msloudspeaker.com