This page documents instructions for use of the Innovatia Renesas M3850A microcontroller programmer. The following design uses a DB-25 type parallel-port cable, and requires MS-DOS 6.22 or earlier. This is because Microsoft Windows restricts access to the parallel-port except through Windows API, and also, Windows is inadequate for real-time port operation. A version of the programmer software was first written in Visual Basic on Windows, although because of Windows garbage-collection routines, the program was incapable of meeting the time constraint of the data reception time-out (mentioned briefly on page 64 of the data sheet, although the data sheet never mentions how long the data reception time-out is). The programmer operates the microcontroller in Standard Serial I/O mode, as described on page 53 of the data sheet.
Page contents:
Programmer Circuit
The following schematic was designed and first implemented by Mark Ludwig, although I made a few minor modifications to the circuit design.
Using the programmer software
To begin, run the executable file MCPROG.EXE. An MS-DOS application will launch, displaying a menu of the available commands.
The main screen displays all the commands supported by the programmer software. Below the list of commands, there is an "Open File" field, which indicates the location of the last file which has been uploaded to or downloaded from the microcontroller. Below that is the size of the file. The "Port Address" field indicates the I/O address of the parallel port on the computer. At the bottom of the screen is the keyboard prompt. The line above that (blank in Figure 2) is the status label for the program, where status, error, and success messages will show up.
When the program is launched, the keyboard prompt will ask for a command. At this point, the user will type in any of the commands listed in the command list. The commands are case insensitive. The commands are described in the following sections.
PORT command
Use this command is to change the I/O address of the parallel port. After entering the command, enter the address of the parallel port in Hexadecimal, and then press ENTER. If successful, the status label will indicate the port address has been changed, and the port address field will reflect the new address. If the port address is incorrect, after a port read or write operation, the status may display the message "Failed to communicate with port", although this is not guaranteed.
RESET command
This command resets the microcontroller by outputting a low value to the microcontroller's reset pin for one second.
WRITE command
This command prompts the user for a binary file, and transfers the data to the microcontroller. After entering the command, a file selection tool will pop up. At that point, the user will select a file from the hard drive. If the file is not within the size range 2 KB to 32 KB, or if the size of the file is not a multiple of 256 bytes, the write operation will cancel, and the status will display an error message.
If the file size is valid, the programmer will begin to attempt to transfer the file to the microcontroller through the parallel port. On the microcontroller, the program memory extends until page address 0xFF. The software determines the program memory address at which to start transferring the contents of the file by subtracting the number of pages in the file from 0x100 (so if the file size is 16 KB or 64 pages, the file will be transferred to the microcontroller starting at page address 0x100 � 0x40 = 0xC0).
The write operation writes one page at a time. After each page has been transferred, the software then reads back the page and verifies that the data has been transferred correctly to the microcontroller. If a page verification fails, the write will cancel, and the status will display an error message indicating the page and byte address at which the write failed. Possible reasons for the transfer to fail are the port address is incorrect, the microcontroller is locked, the selected file is too large for the microcontroller's program memory, or there is some other hardware-related issue.
During transfer, the status will indicate which page is currently being sent over the parallel port. If all page transfers are successful, the write operation will end, and the status indicator will display a success message.
READ command
This command allows the user to download the program memory from the microcontroller. After entering the read command, the user is prompted to type in a file name. After entering a file name, the user is prompted for a start and end page address in hexadecimal. The program will then attempt to read the data from the microcontroller. If during the transfer process, the microcontroller stops responding for five seconds, the status will indicate a timeout has occurred. If the data has been successfully downloaded, the status indicator will display a success message. Possible reasons for the read to fail are the port address is incorrect, the microcontroller is locked, or there is some other hardware-related issue.
ERASE command
This command is used to zero out the memory of the microcontroller. The microcontroller program memory must be blanked out before each write operation. Also, the microcontroller must be unlocked before the program memory contents can be erased.
STATUS command
This command returns the two status registers SRD and SRD1 from the microcontroller. The status registers are described on pages 63 and 64 of the Renesas 3850A specifications sheet.
VERSION command
This command retrieves the 8-byte version string from the microcontroller (see page 61 of the data sheet).
ID command
This command allows the user to enter a 7-byte identification code for unlocking the microprocessor. Once the microprocessor is programmed, the ID is required before reading or writing to the processor again. The 7-byte ID code is stored in the chip's program memory from address 0xFFD4 to 0xFFDA. For further details, refer to page 62 of the data sheet.
QUIT command
Exit the program, and return to DOS.
Source Files
The programmer software was written using FORTH 83. The following files are required for compilation of the programmer software.
Application files
File Name | Description |
F-PC.SEQ | Controls compilation of program |
MCDRIVER.SEQ | Controls communication with the parallel port, as well as data transfer to/from the microcontroller |
MCFILE.SEQ | Contains File I/O words |
MCMENU.SEQ | Prints out the main menu |
MCPROG.SEQ | Main application; waits for keyboard events, executes commands |
MCUTILS.SEQ | Miscellaneous utilities, such as string manipulation and screen navigation |
FORTH 83 core files
The following files are unmodified copies of FORTH 83 core files.
File Name | Description |
KERNEL.COM | Compiles the new F-PC executable file |
FPC/BOXTEXT.SEQ | Ability to draw boxes |
FPC/BUFSET.SEQ | Automatically adjust read buffer size |
FPC/CASE.SEQ | A CASE utility needed by PASM.SEQ |
FPC/COMMENT.SEQ | Allows multi-line comments in source |
FPC/DECOM.SEQ | Decompiler |
FPC/DEFERS.SEQ | Adds DEFERS and UNDEFERS |
FPC/IBMCURSR.SEQ | IBM cursor shape control words |
FPC/LEDIT.SEQ | Line editor utility |
FPC/LOADEXE.SEQ | The load part of the SAVE-EXE mechanism |
FPC/MONOCROM.SEQ | Monochrome support |
FPC/NEWLAB.SEQ | New local label definition file |
FPC/PASM.SEQ | Prefix/Postfix assembler for 8086/8088 |
FPC/PATHSET.SEQ | Includes paths on files |
FPC/PERTYPE.SEQ | Imbedded display attributes in TYPE |
FPC/QVIDEO.SEQ | Speed up screen display |
FPC/SAVEEXE.SEQ | The save part of the SAVE-EXE mechanism |
FPC/SAVESCR.SEQ | Screen save and restore |
FPC/TIMER.SEQ | Timing and measurement words |
FPC/TIMESTUF.SEQ | More timing words |
FPC/UNHEAD.SEQ | A utility to remove some heads from F-PC |
FPC/UTILS.SEQ | Some low level utilities |
FPC/VALIDATE.SEQ | Old version checking for F-PC |
FPC/VOCABS.SEQ | Forth's ONLY ALSO vocabulary structure |
FPC/WFL.SEQ | Window file selection |
FPC/XEXPECT.SEQ | A NEW line editor for EXPECT |
Compilation
To compile the custom F-PC application, invoke the following DOS command:
To create the turnkey executable file MCPROG.EXE, invoke the following DOS command:
Download
mcprog.zip | MCPROG source (82.2 KB) |
mcprog.exe | MCPROG binary (65.0 KB) |
mcprog.ckt | CircuitMaker schematic (9.0 KB) |
Renesas 3850A Specs - DEC07.pdf | Renesas 3850A Specifications (848 KB) |