PJRC.COM Offline Archive, February 07, 2004 Visit this page on the live site |
| ||
Shopping Cart Checkout Shipping Cost Download Website |
Home | MP3 Player | 8051 Tools | All Projects | PJRC Store | Site Map |
You are here: 8051 Tools PAULMON Monitor Manual Program Headers | Search PJRC |
.equ locat, 0x8000 ;Location for this program .org locat .db 0xA5,0xE5,0xE0,0xA5 ;signiture bytes .db 35,255,0,0 ;id (35=prog) .db 0,0,0,0 ;prompt code vector .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;user defined .db 255,255,255,255 ;length and checksum (255=unused) .db "Program Name",0 ;max 31 characters, plus the zero .org locat+64 ;executable code begins hereAdmittedly using the Run Command instead of the Jump Command isn't a big advantage. The most compelling reason to use the normal program header is because it is later quite easy to change it into the startup header.
Startup programs are really only useful when used with nonvolatile memory. With Flash ROM, programs may be written via the Download command, but they will remain in memory.
Instead of replacing PAULMON2 (at 0000), the final application program can be turned into a startup program by changing a byte in it's header. If Flash ROM is used, the board will always startup to the intended program. The lines to add to define a startup header should look like this:
.equ locat, 0x8000 ;Location for this program .org locat .db 0xA5,0xE5,0xE0,0xA5 ;signiture bytes .db 253,255,0,0 ;id (253=startup) .db 0,0,0,0 ;prompt code vector .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;user defined .db 255,255,255,255 ;length and checksum (255=unused) .db "Program Name",0 ;max 31 characters, plus the zero .org locat+64 ;executable code begins herePAULMON2 has a feature where an erase pin may be defined. If this pin is held low after a reset as PAULMON2 starts up, it will attempt to erase the Flash ROM. By providing a jumper which pulls this pin low when installed, the application program (in Flash ROM) may be deleted and a new version may be downloaded without having to pull the EPROM, as would be necessary in a system without PAULMON2 and Flash ROM. The default erase pin is P3.5 (T1, pin 15).
The startup program header feature is intended work together with Flash ROM to provide a quick and easy way to make the application under development permanent, without pulling any chips, without having to worry if the program will correctly initialize the hardware without having run PAULMON2 first, and with a simple (and well tested) mechanism to erase and download a new version of the permanent startup program should changes become necessary.
In some cases, it may be desirable to install a startup program which initializes hardware or performs some startup function but then allows PAULMON2 to begin normally. In this case, the startup program must terminate with a RET instruction to return back to PAULMON2. Obviously the stack must point to the return address which PAULMON2 originally pushed before running the startup program.
This type of startup program is normally only used to avoid the automatic baud rate detection. The fix_baud.asm example program shows how this should be done. The value for "baud_const" is required. This can be found by running the my_th1.asm, which will tell you the value that the automatic baud rate detection guessed at startup.
These two programs can also be downloaded in a ZIP File.
It is also possible to customize PAULMON2 with a fixed baud rate for use the hardware's crystal frequency.
.equ locat, 0x8000 ;Location for this program .org locat .db 0xA5,0xE5,0xE0,0xA5 ;signiture bytes .db 254,'A',0,0 ;id (254=command, key='A') .db 0,0,0,0 ;prompt code vector .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;reserved .db 0,0,0,0 ;user defined .db 255,255,255,255 ;length and checksum (255=unused) .db "Command Name",0 ;max 31 characters, plus the zero .org locat+64 ;executable code begins hereIn this example, the command will be executed when the user presses the 'A' key. The specified character must be uppercase, because PAULMON2 calls the upper function to make the user interface case insensitive.
For more detailed information about Adding Commands to PAULMON2, and some examples, please refer to that section.