-
As a self-taught microcontroller, I loyally advise you not to go to the online e-book to read, buy a Keil C51 book by yourself, step down, read it slowly, don't worry, read it again if you don't understand it, you will definitely understand it. As for your specific question, writing C programs with Keil generally does not require the user to care about the memory allocation of the program's variables, and as for SP, the compilation environment will automatically find an optimal RAM allocation for you, and you don't need to care about RAM conflicts at all. Of course, the specific problem is difficult to say, I am an electronic enthusiast, I am happy to help you, you can contact by email:
-
Why do you need to define the unsignedchar type at the beginning, can't you use unsignedint instead?
What is the purpose of char type data in a microcontroller?
What I want to say is that a microcontroller is not a general-purpose PC.
Although the RAM inside the current microcontroller is getting bigger and bigger, it is still limited compared to the computer, unsignedchar can be replaced by unsignedint, but it takes up too many bytes.
The character type is 1 byte long, while the integer type is 2 bytes long.
The char type of the single-chip microcomputer is not the same as the one in C, because the 52 you use is an 8-bit single-chip microcomputer, and the char type is 8-bit, so it is easy to operate.
Feel free to ask. No, the lower octet of the int type is recognized.
-
Programming is inherently difficult, not to mention a single-chip program, and now the primary question is what do you know about the C language, are you proficient? Skilled? How many programs have you programmed in C.
If all of the above is done, it will be much easier to make up the others.
-
1. For the IO port that comes with 51, for example, send the P0 port status to the accumulator, you can write it like this:
acc = p0;
acc is the accumulator, and p0 is the port name. These identities have been defined in and can be referenced directly.
2. If it is an extended external port, generally these ports will have corresponding addresses, and you can directly use their addresses when accessing. For example, if Chasun Sou uses the 8255 chip to expand the IO port, an 8-bit port address in its defeat history is 0xc001, which can be written like this:
acc = xbyte[0xc001];
Among them, xbyte[ ] is the method for 51 microcontrollers to directly access external storage memory.
3. As for the outport and import mentioned by the landlord, they are used in the computer, and are not used in the C language of the single-chip microcomputer (at least not in the most commonly used Keil C compiler).
Hello, the Mitsubishi microcontroller you mentioned should have long belonged to a part of Renesas microcontroller, and those models that started with M in Renesas microcontroller were inherited from Mitsubishi, but I didn't find the M37531M4FP you said, I only found the M37534M4-FP, I don't know if only the capacity is different, anyway, the attached picture is for your reference. If you need the full manual, please download it from the official link below**. >>>More
The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More
You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More
With c, I think about it:
1. It has something to do with hardware, do you know this? >>>More
The method of using two timers is to use the timer t0 to control the frequency and the timer t1 to control the duty cycle. The general programming idea is as follows: the t0 timer interrupt makes an i0 port output high, and starts the timer t1 in the interrupt of the timer t0, and this t1 makes the io port output low, so that changing the initial value of timer t0 can change the frequency, and changing the initial value of timer t1 can change the duty cycle. >>>More