??? 02/09/07 06:58 Read: times |
#132333 - Back to basics, ... not BASIC! Responding to: ???'s previous message |
Mike Stegmaier said:
After everyone's comments and my ideas, I think it is now time for me to create a new plan for my 8051 system/programmer combo. Starting over, maybe thinking things through first ... good plan! Keeping in mind that you don't want to change microcontroller or memory IC's ... What I will do is attach the crystal to the microcontroller the way it is supposed to be attached (to X1 and X2 on the micro), and maybe I will ground X1 and X2 through 33pF capacitors. Then I can guarantee a working clock. Yes, and you won't need to start/stop it, which is a good thing. Then I can connect the parallel port to port 1 pins and 2 control pins from the parallel port to INT0' and INT1'. You may be putting the cart before the horse, here. I can write the code, BUT here's the catch. The code must be hardwired. The reason for that is because the code must run, even if the rom is not programmed (example: a new chip has beem put in). I'm not sure how you'll accomplish this. I'd suggest you consider a simpler way, of which there are several. I know for a fact that I need a set of buffers (74HC245 will work) between the hardwired section and the data lines, so that it wont interfere when data is read from the EEPROM or RAM. You'd better have a really large board, and many hundreds, perhaps even thousands, of gates and flipflops available. I know that I need to use some address lines as inputs. Just whose address lines did you have in mind? Here is where problems come in: I fear they're already here ... Rather than me manually writing out the codes for each instruction on paper, and manually decoding it, I want to automate the whole thing. A good idea, for sure! As for converting a script to the correct byte codes (the codes that you see in an EXE file for example), I can easily do that. PC-style EXE files have no place in the "real" world. Your 80C51 will want absolute binary code. Now converting the byte codes to a simplified requires boolean algebra knowledge. I can do it by hand, but I would rather see that software can do it instead. To a simplified what? Executable code for 80C51 is most often generated by typing the mnemonic code using a text editor and the using that text file as input to a "CROSS-ASSEMBLER" that runs on the PC. The CROSS-ASSEMBLER generates one or more output files, of which one is usually either an absolute binary file suitable for programming into a ROM of some sort, or a "HEX" file suitable for feeding to a programmer that then programs the ROM, or both. There are more involved ways of doing this, but I suggest you start small. Why?
Because I want to avoid wasting two months or more on creating the optimal circuit. If creating an optimal circuit takes two months or more, would you consider that time wasted? The easiest way out is to use a bunch of "and" gates and inverters, but if I can avoid that, I will be happier. I'm afraid you may be mistaken there. A circuit to hard-wire 1 KB of code can require many hundreds or even thousands of gates and flipflops. Programming you EEPROM may take more code than that ... There are much more efficient and effective ways of approaching the task of programming an EEPROM. Of course, you do have two entirely independent tasks before you. (1) you need to construct a circuit by means of which you can run your 80C51. That 80C51 apparently has an 8kX8 external SRAM. (2) you need a toom by means of which you can program your EEPROM so the 80C51 can execute code within it. So I see that I need to perform boolean algebra. You'll need to learn to do that in order to do any sort of effective programming. If you search for it on Google, or whatever search engine you prefer, there's lots of information. It's not difficult to learn. I can write many programs in Quick Basic and PHP. so if someone can give me a basic idea in an easy mathematical sense on how the laws of boolean algebra work, then maybe I can figure the rest out. QB and PHP have no role in microcontroller programming. So in other words, I want to make a hardware based rom that supplies code to the data lines based on a fixed address. I have to discourage you from considering this. I don't know how old you are, but your grandchildren will likely be retired before you get this done. As for the code, it may vary depending on the number of gates required. I am willing to add a few "nops" in my code if it makes the logic alot easier. The necessary hardware won't fit on a board you can lift, let alone afford. There's probably a better way ... I'd love to see you get this done, but building a ROM big enough to contain code sufficient to accomplish your task will take a lot of design time, in the decades, probably. Please help me on this. Thanks. Before you get all "wrapped around the axle" on this approach, consider, for a moment, that it's pretty easy to write from your parallel port to an SRAM. Consider, too, that it's possible, with a little imagination, and a little hardware, to move the SRAM in and out of code space. The 80C51 has separate code and data spaces, unlike a PC, so you can't write to code space from the 80C51. However, with a simple bit of logic, you can build a circuit that enables you to do so, under the control of the PC, or of the 80C51. If you provide a control register, and a little additional logic, and some data registers, you can easily write directly to your SRAM, map it into code space, and program the EEPROM from that. Moreover, you can move PART of the SRAM into code space, thereby allowing you to execute the code that you wrote from the PC parallel port to the SRAM, yet still use the SRAM to receive additional code from the PC parallel port. Now ... let me ask a few simple questions ... Have you ever programmed any sort of microcontroller before? Have you ever written a program in assembly language ... ANY assembly language? Have you ever designed a simple system? Do you know what top-down design methodology is? Do you know what "system requirements" means? Have you familiarized yourself with the instruction set of the 8051? Have you familiarized yourself with the hardware of the 8051? You do know, that there is almost no similarity between programming a PC and programming a microcontroller, don't you? There's lots of information on 8052.COM to help you fill any gaps in your understanding. Look the available resources over carefully. Find out what free software is available. Become "intimate" with one or more of the available simulators. You can learn a lot of basic 8051 programming by playing with a simulator. Don't let that fool you into complacency, though. You do have to know the "real" stuff. Read the datasheets, i.e. "the bible" as it's presented on 8052.COM. That will help a lot. RE |