| Details | Message |
|---|
Read-Only Author Bruno Adami Posted 4-Jul-2009 15:06 GMT Toolset None |  Is this somehow possible? Bruno Adami 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! |
|
Read-Only Author Tamir Michael Posted 4-Jul-2009 16:00 GMT Toolset None |  RE: Is this somehow possible? Tamir Michael One of the possibilities to do this is to have separate regions in flash that are dedicated to a certain functionality, and will be programmed by separate targets of a uv3/4 project or a separate project. so, the main program will reside starting at the well know entry point to flash, and when necessary it will jump to and execute code residing somewhere else. you can distinguish between these zones with a scatter file or have a separate such file per "plugin". do note that you would have to introduce a mechanism that would prevent the chip going astray if no "plugin" is really installed... |
|
Read-Only Author Correcting Zeusti Posted 4-Jul-2009 16:39 GMT Toolset None |  RE: Is this somehow possible? Correcting Zeusti HI. yes it is posibble and quiet easy. it can be like the bios of a pc runnning apps. but you will probebly have to wright it all. look at the upsd from st. you can map different flash blocks to one adress. so good. but do not look for the scatter file in 8051 from Tapeer. he an arm man and does not know the 8051 uvision projects do not have scatter files. Always yo're freind. Zeusti. |
|
Read-Only Author erik malund Posted 4-Jul-2009 16:58 GMT Toolset None |  end of life erik malund look at the upsd from st. you can map different flash blocks to one adress. so good. the upsd's are to be discontinued, if I recall, last shipments in may. Erik |
|
Read-Only Author Correcting Zeusti Posted 4-Jul-2009 19:50 GMT Toolset None |  RE: end of life Correcting Zeusti ERIK. <quote. the upsd's are to be discontinued, if I recall, last shipments in may. </quote> i did not know it. that is baaaaaaaaaaad news for me :( they were very good. except for the bad iic impelementation. |
|
Read-Only Author Mike Kleshov Posted 4-Jul-2009 16:15 GMT Toolset None |  RE: Is this somehow possible? Mike Kleshov Is this possible? With other microcontroller maybe? Of course it is possible. You can see it on desktop PC's all the time when you launch programs. Nothing prevents you from implementing similar functionality on a 8051 MCU. But this kind of task is not for a novice programmer. You should be familiar with OS design techniques in order to do this. And the 8051 is certainly not the best architecture for this. |
|
Read-Only Author erik malund Posted 4-Jul-2009 17:04 GMT Toolset None |  possible erik malund software in a memory and load it from 8051 to run on it sure, but a "wrestling match", the '51 is a HARWARD architecture and thus not a good choice for such. There has been hundereds of attempts to make "the '51 PC" all have failed. If it is a matter of 2 or 3, I have seen it done with an "external flash selector". Anyhow, your post is not in "'51 language" read up on "the bible" and reformat your question and you can get a clear and definite answer Erik here are the links to "the bible" Chapter 1 - 80C51 Family Architecture: http://www.nxp.com/acrobat_download/various/80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: http://www.nxp.com/acrobat_download/various/80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: http://www.nxp.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf |
|
Read-Only Author Bruno Adami Posted 4-Jul-2009 17:21 GMT Toolset None |  RE: possible Bruno Adami I didnt think about that, but it would work as a computer :o Anyway, you all said hard terms and complex names that I dont understand very well, I am a begginer on microcontrollers :) I have a good experience in programming, only on PC. So, 8051 family is not a good choice to make that? What should I choose? |
|
Read-Only Author Per Westermark Posted 4-Jul-2009 18:04 GMT Toolset None |  RE: possible Per Westermark I would start with another question. Why? Why do you want to implement plugins? To add functionality at a later stage? The normal way would be to update the full application at that time. To let an end-user add new functionality, without giving away the full source code? Another way of doing this would be to implement a virtual machine, that runs a byte-coded application. This would be similar to the programs to write for a programmable pocket calculator, or the macros you use in a spreadsheet. |
|
Read-Only Author Bruno Adami Posted 4-Jul-2009 18:35 GMT Toolset None |  RE: possible Bruno Adami 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. :) |
|
Read-Only Author Per Westermark Posted 4-Jul-2009 19:39 GMT Toolset None |  RE: possible Per Westermark 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. |
|
Read-Only Author Bruno Adami Posted 5-Jul-2009 23:32 GMT Toolset None |  RE: possible Bruno Adami So, should I use a microcontroller or a microprocessor for this kind of stuff? |
|
Read-Only Author Mike Kleshov Posted 5-Jul-2009 23:47 GMT Toolset None |  RE: possible Mike Kleshov 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? |
|
Read-Only Author Bruno Adami Posted 6-Jul-2009 00:40 GMT Toolset None |  RE: possible Bruno Adami 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? |
|
Read-Only Author erik malund Posted 6-Jul-2009 02:29 GMT Toolset None |  same answer erik malund 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 |
|
Read-Only Author Bruno Adami Posted 6-Jul-2009 03:30 GMT Toolset None |  RE: same answer Bruno Adami So, what I should conclude? |
|
Read-Only Author erik malund Posted 6-Jul-2009 14:11 GMT Toolset None |  for loaded program ... erik malund 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. Erik |
|
Read-Only Author Mike Kleshov Posted 5-Jul-2009 07:38 GMT Toolset None |  RE: possible Mike Kleshov 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? This sounds like the perfect application for a scripting language. Have a look at Pawn: http://www.compuphase.com/pawn/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. |
|
Read-Only Author Per Westermark Posted 6-Jul-2009 04:58 GMT Toolset None |  RE: possible Per Westermark 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. |
|
Read-Only Author Bruno Adami Posted 6-Jul-2009 14:15 GMT Toolset None |  RE: possible Bruno Adami 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? |
|
Read-Only Author erik malund Posted 6-Jul-2009 15:18 GMT Toolset None |  as suggested before erik malund ARM |
|
Read-Only Author Bruno Adami Posted 7-Jul-2009 02:53 GMT Toolset None |  RE: as suggested before Bruno Adami Thank you again! I noticed that there are 2 downloads in the evaluation area: Keil evaluation tools GNU development tools Which I should choose? |
|
Read-Only Author Per Westermark Posted 7-Jul-2009 07:59 GMT Toolset None |  RE: as suggested before Per Westermark 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. |
|
Read-Only Author Per Westermark Posted 7-Jul-2009 10:31 GMT Toolset None |  RE: as suggested before Per Westermark 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. |
|
Read-Only Author guembri ayed Posted 15-Jul-2009 12:48 GMT Toolset C166 |  RE: possible guembri ayed 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 |
|