Using the DDS C Compiler with the uPAC 535 When using DDS C for the 8051 on the uPAC 535 there are a few modifications required after DDS has been installed. A batch file (535C.BAT) is provided on disk that automatically makes these modifications for you. The modifications are all contained in the files 8051RLPC.ASM. The batch file replaces the files with ones that contains the modifications. The modifications are the starting address for downloaded programs (0A000H), the starting address of usable RAM (8000H). The starting addresses gives you 24K of code space and 8K of Stack/Variable space. --------------------------------------------------------------------------- To start the Integrated Development Environment (IDE) change directories to C:\MC CD C:\MC then type C You should now be presented with the option to select a file. Using the cursor keys select... Hello.C and press Enter. You are now in the Editor screen where you can enter programs and make changes. The file 8051.ide which is copied from the disk by the 535C.BAT file contains all of the configuration defaults for DDS. Two of these configurations for the PC are, COM2 serial port and 9600 baud. If these are incorrect you can change them by pressing... Alt O (that is the key and the O key at the same time). You are now presented with a menu of choices. Make any changes that are required by selecting with the up/down cursor keys and pressing Enter. When you are through, press Esc to return to the Edit screen. The next step is to compile the Hello.C program. This is done by pressing... Alt C (that is the key and the C key at the same time). Use the cursor key to select "Compile" and press Enter. A window appears at the bottom of the screen. If any syntax errors had occured this is where you would be notified of them. You would then fix the errors in your program and recompile until you have 0 errors. Once you have a clean compile a Hex file of the same names is created with a .Hex extension, this is the file which will be downloaded to the uPAC 535. To download the Hello.Hex file just created, press Alt T (that is the key and the T key at the same time). Use the cursor key to select "Connect" and press Enter. -------------------------------------------------------------------- This places you in the terminal mode. Now press the key several times until the MON51's "*" prompt appears. type the word... HELP you should see the MON51's help menu on your PC's screen. If you do not see the menu then make sure the the baud rate and the COM port are correct and try again. You may also try establishing communications with Procomm which is provided on the disk. Once communications have been established type DOWNLOAD followed the the Enter key. Now press your PC's function key F3 You will be prompted for the Hex file to download, if the file is correct hit Enter. Once the download is complete, provided it was successful, the "*" prompt will return. To start the program type... GO FROM 0A000 The program should now print on your PC's screen Hello World then terminate. To return to the Edit screen just press... Esc -------------------------------------------------------------------- There is another C program that works with the uPAC 535, BJ535.C. This is a simple Black Jack program and is located at \mc\examples. This program has been enhanced by EMAC and is far superior to the one that is included with DDS. -------------------------------------------------------------------- The C compiler has a number of options of its own. By pressing... Alt C and selecting "options" you can turn on/off Full ASM Listing which will give you a .lst file (ASM source file with Addresses, Opcodes, and comments) and C-Source Comments that can be very useful for debugging. These options are on by default. -------------------------------------------------------------------- When you are ready to burn an EPROM: 1. Add any serial initialization that will be required by the absence of the monitor program. In the case of the bj535.c program, this consists of uncommenting the command "serinit(9600);", as per instruction in the comment text in the code. For other user programs, this may consist of adding the serinit(baud) command with the appropriate baud speed, or adding your own custom serial port initialization code. If your program does not use the board's serial port, do nothing for this step. 2. From the DOS prompt, execute the batch file TARGBURN.BAT by typing "targburn". This will give you instructions for using the program. If you are unsure of which memory model to use, use the default, "Large." This sets the least number of limitations on user code, and provides the greatest chance of proper execution. Note that in some instances, user code which compiles properly may not execute correctly due to an incorrect memory model being specified. If you think this may be the case, check the documentation that came with your Dunfield Micro-C compiler for specifics of each memory model. If the compile was successful, a file with the same name as your .c file and the extension .hex will now be in the same directory as your .c file. This is the Intel hex file you will use to burn your EPROM. Expert Instructions: Execute step one from above. Next, choose your memory model from the "Compile -> Options" menu. If you are unfamiliar with various memory models, check the Dunfield Micro-C documentation. When in doubt, Large usually works. You will have to edit the startup assembly code provided by Dunfield, which the Micro-C compiler prepends to all user programs. These startup files are found in the lib51\ directory. Which file you edit is determined by your memory model: 8051rlpt.asm for tiny, 8051rlps.asm for small, 8051rlpm.asm for medium, and 8051rlpl.asm for large. You will need to change the ?RAM, ?RAMEND, and first ORG statements to reflect your desired location of code and the available addresses of external RAM. The ORG statement will generally be set to address 00h. For the mp535 with memory in Von Neumann configuration, RAM will begin at 8000h and end at FFFFh. For examples, look at the files with the .brn extensions. Once the startup code has been modified, you may compile your program using the command line compiler or the DDS IDE, and use the resulting .hex file to burn your EPROM.