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 :)
I am new to 8051 family programming and I have a question. I would like to know if there is anyway, somehow, to put another software in a memory and load it from 8051 to run on it. It would work similar to plugins :)
Speaking in C language, it would be like a function inside the memory that do something. That function receives a pointer to a structure that has many other functions that the main software inside the microcontroller has, like display things on a screen. Well, is very similar to plugins :)
Is this possible? With other microcontroller maybe?
If I said something wrong or confuse please, let me know! Thank you!
No, it will be open source. Its just to not let the user mess with the screen control or buttons, dunno, I am constructing the idea :)
Well, it would be easyer if he uses the sample codes to handle the screen, buttons, etc... There is anyway to create libs? But I would like to add a start routine that the user cannot change. The user needs to easily save the program into the microcrontoller, without the need to buy something special.
The main idea is to let the user create softwares for a hardware, then he could save it on the hardware as easy as pie. And he needs not to overwrite other softwares that he created, so there will be a list that he choose to run on the microcontoller, is this too confusing?
Ok, I will tell what I will try to do (and some friends). Its a work that my teacher asked, we need to do something with a microcontroller (dont need to be 8051), and we would like to make a very simple minigame, that we could create the games and easily put it on the minigame! Then there would be a list of the games that it contains, and we would choose one to play.
:)
Just a quick note here. If you are going to do something with a graphics display, the amount of work will quickly explode. And the amount of load on the processor will also increase. Please look at an ARM chip. It is a way more general processor, reducing the amount of time you will have to fight with the processor.
But an even more important thing. Don't start too ambitios. Start with something simple. Get it to work. Then spend time thinking about how to extend it. Better to end up with a solution that only plays one game - such as tetris or some board game - than to have spent a lot of hours and end up with an unfinished product. The important thing is to do something that regularly gives you positive feedback. Progress is very important.
If you decide to continue, after having a working platform, quite a lot of simpler games can be implemented as byte-coded applets.
The general concept of a library is quite advanced. A real library requires linking. Either dynamic or static. But that linking step requires you to know how to update references inside the code, to make a call or variable reference from one module end up reaching the correct function or variable in another module. It is a very complex concept, unless you not only are very good with C (and possibly assembler) and are good at extracting information from the compiler output files. The C51 compiler is totally unsuitable for this, because of how the C51 compiler interacts with the linker.
And switching to a solution with function pointers requires a processor that is comfortable with pointers which means that you want a general-purpose processor with good I/O abilities. The 8051 chip is not general-purpose. It is very good at bit-access I/O, but falls short when it comes to general pointer and memory manipulation.
Whatever route you decide to do - implement a single game, try a byte-coded virtual machine or implementing a BIOS-style solution with function pointer arrays or similar - do not (!) select a 8051 chip. Just about any other chip would be better. I like ARM chips, but there are several other architectures that will all be way better than a 8051 chip for this kind of project.
So select a GP processor, start small and then see where you end up.
This sounds like the perfect application for a scripting language. Have a look at Pawn: www.compuphase.com/.../pawn.htm I used it for a similar application, works like a charm. I doubt Pawn can run on a 8051, though. Why not pick one of the ARM's? You should be more comfortable with a 32-bit CPU. On the other hand, ARM-based MCU's are usually more difficult to get started with than 8051-based MCU's.
So, should I use a microcontroller or a microprocessor for this kind of stuff?
I'm sorry, but this sounds like a completely wrong question to ask. Are you sure you understand what you are going to do?
Yes, microcontrollers are a small computer, a CPU combined with timers, watchdog, serial and analog I/O, RAM, etc, all in one chip. Microprocessors are the CPU, something like that.
So, should I use a general purpose microcontroller or create my own system with a microprocessor?
I'm sorry, but this is a completely wrong statement. Are you sure you understand what you are going to do? (slightly infringing on Mikes copyright)
microcontroller/microprocessor are just names applied by salesmen.
The answers you have gotten have NOTHING WHATSOEVER to do with that. They relate to ARCHIECTURE
Erik
So, what I should conclude?
All I recommended was to select a processor with a general purpose architecture. A general-purpose processor maps well between C code and assembly instructions. It normally helps with the size of a normal processor register is the same as the size of a pointer.
The 8051 instructions maps badly to C. It takes a lot of work-arounds for a 8051 to work with function and data pointers, and having separate memory spaces for code and data affects what - and how - you can implement things.
The separation between a microprocessor and a microcontroller is hard to make. Is it enough to add a timer to get a microcontroller? Or is it when it has internal data and code memory? Or when it can toggle individual pins? In the end, should should not bother with such distinctios. You should make a list of needs, and then you can do the shopping, and decide if everything should be built in, or if some of the required features should be implemented by external solutions.
Selecting a processor with every needed feature included can be very convenient, since you have less hardware to search errors in. It may be enough to supply power to get the processor up and running, making use of an internal RC oscillator until you let the software decide on an external crystal. Having flash an RAM internally, means you can't wire any such signals wrong or have too slow memory or happen to invert a signal. Having most of the high-speed signals hidden inside the processor will also reduce problems with noise sensitivity, or with radiation.
With a traditional microcontroller, you can often decide in your software if individual processor pins should be digital inputs, digital outputs or have special-purpose functions such as UART, SPI, PWM, ... That means that you can implement a self-test function that slowly toggles the different pins while you look at the behaviour of external hardware.
But all this is just a question of convenience, and total cost for required chips, required board space etc. And you can build a game with a processor having an internal LCD controller for directly interfacing with a graphical LCD. Or you can use a LCD with own controller that interfaces as a large external memory or as a few register addresses where you first write a memory address to the display and then write pixel data.
A sw engineer has to make a lot of design decisions about the firmware. A hw engineer has to make a lot of design decisions about the hardware. Often the same person(s) has to work as both sw and hw engineer(s) and decide on trade offs between cost of hardware or time to implement in software.
People on this forum can't know the level of your hardware skills or software skills or how much money you are ready to spend, or how much time or how advanced you want to make your project. That means that you and your friends will just have to make a lot of decisions.
The only thing we can say is that you should stay away from a 8051 processor since a number of things you are thinking about does not map well to the 8051 architecture. Some other 8-bit processors can handle it way better. A 16-bit processor will be better. A 32-bit processor will most probably be even better. But the world has seen a large number of very advanced games designed around very old 8-bit processors, so in the end, the biggest deciding factors will be skills and creativity. A good developer can do wonders with little.
Just notice that small and large are relative terms. A processor with a lot of memory and/or peripherials from one manufacturer can be cheaper than a processor with few features from another manufacturer. A 32-bit processor can be cheaper than an 8-bit processor. So in the end, it will come down to how well a specific processor fulfills your shopping list requirements. And while ARM chips are often a good starting point, the truth is that you must make that shopping list and then compare it to what is available out there.
One thing I recommend that you add to your shopping list is the ability to perform easy In System Programming (ISP). Being able to use an RS232 port to reprogram the chip can be very convenient. You would also do well to select a processor with In Application Programming (IAP) to allow your application to write new contents to the code memory. This reduces the need for you to add external EEPROM memory for storing byte code or maybe plugin modules that may need to be copied into RAM to be usable.
A processor selection list for chips supported by Keil development tools can be found at: http://www.keil.com/dd/search_parm.asp
But may just as well use a Microchip PIC processor, any AVR chip from Atmel, a PPC, some of the Texas offerings, ... You can spend months looking for processors and still regularly find new processors that are suitable for the task. But you must decide what is good enough.
for loaded program ... a Harvard chip is not a good choice, why wrestle when you do not need to, ude a vonNeumann chip.
That was a complete answer :)
But, as I dont have any experience with another chip rather the 8051, what do you recommend? Is there any cheap, good and easy microcontroller that Keil supports?
ARM
Thank you again!
I noticed that there are 2 downloads in the evaluation area:
Keil evaluation tools GNU development tools
Which I should choose?
The Keil evaluation tools are good but size-limited. If you go for the Keil tools (they are quite good) you will need to buy the (quite expensive) commercial license.
gcc does not have a size limitation. But Keil dropped support for gcc long time ago. And to my knowledge, you will still not be able to debug larger code.
I use the commercial version of Keil tools, so you will have to wait and see if there is any gcc user here who can jump in and give better feedback about that alternative.
The two choices are not fully compatible. The biggest difference will be in the startup code, which is written in assembler. Depending on what target processor you use, there may also be code differences when you implement interrupt handlers.
There are other vendors who have products based around the gcc. But same thing there - you will have to find some user to get some feedback about the offerings.
An alternative when looking for development tools is to select a development board with uClinux already ported. Then you can get all software tools you need for free.
On the other hand, this may not match your intended problem.
Hi Mike, I start with pawn and i want to use it in µc infenion XC116. Please, can you send to me an example of source where you use pawn in µc?
Ayed