Introduction

 

All devices have signature bytes that the programmer reads to automatically identify the chip. No need to select the device type ¡V just plug it in and go! Even includes a ¡§bulk programming¡¨ feature to reduce keystroke when programming multiple chips.

 

All devices also have a number of lock bits to provide various levels of software and programming protection.

 

The programmer connects to a host computer using a standard RS232 serial port. All the programming ¡§intelligence¡¨ is built into the programmer so you do not need any special software to run it. This makes the programmer usable with any computer and any operating system.

 

Just connect using any communication program capable of ASCII text file transfer, such as windows 3.11 terminal, windows 9xHyperTerminal or Dos Telix, procommn, etc. A simple Ds terminal program, ¡¥term.exe¡¦.

 

Specification

 

Power supply :  15VDc

Interface :  Rs232, 9 pin ¡§D¡¨ connector

Data speed   :  9600bps

Data format  :  8 bits, no parity, 1stop, no flow control

File format    :  Intel 8-bit HEX

 

Circuit description

 

The 78L05 regulator provides a stable 5V supply for the ICs. LED PWR indicates power on. Transistor Q1 and Q2 are used to control the programming voltage. With Q1 on, zener Z1 conducts and 5.6V is applied to the base of Q3, giving a 5V programming voltage. With Q1 off zener Z2 conduct via diode 4 and 12.6V is applied to the base of Q2. The programming voltage is now 12V. Resistor R5 limits the current supplied to the programming pin.

 

74HC574 latches the low order address bits when programming the 40 pin devices. Max232 takes care of the TTL ¡V RS232 level conversions.

 

Testing

 

Before applying power, check that all parts are inserted in the correct position. Make sure the electrolytic capacitors and diodes are the right way around.

 

Before inserting any ICs, apply power via the DC jack. LED PWR should come on. Check the following.

 

  1. +5V  output from 7805
  2. VPP voltage +5V/12V on pin31 of A2
  3. VCC +5V on pin40 of A2 and A1
  4. Insert a wire link between pins 13 and Pin 40 of A1. The VPP voltage should now be 5V.
  5. Insert a wire link between pins 13 and Pin 20 of A1. The VPP voltage should now be 12V.

 

Operation and use

 

Connect the programmer to the serial port of a PC (or other host computer) using a ¡¥straight though¡¦ cable. Start a terminal emulation program running at 9600 baud, 8 data bits, 1 stop bit and no parity bit. Apply power to the programmer. A menu will appear. The programmer is ready for use.

 

Insert a chip into the programming socket and enter a command. The programmer first attempts to identify the device and prints an error message if unable to do so. If all is well the function executes and a message print on completion.

 

Any error while receiving the file, such as an invalid hex character or bad checksum, will cause an error message to be printed. The programmer will stop and the user will be prompted to press ¡¥Reset¡¦ to continue. Abort the file transfer before continuing.

 

Hex file fragmentation

 

Most programs are written starting at address 0000h and continuing up from there. Assembers simply take this source file and create a HEX file that is a series of one or more continuous address blocks. However some language compilers such as C or BASIC have a habit of creating HEX files that are full of small blocks of addresses that are not in any continuous order.

 

The data is being sent to the programmer. The programmer uses a small internal buffer to store data as it is received but it can be overrun. If this happens the programmer will stop and print an error message, usually ¡§Hex error¡¨.

 

The problems is fragmentation of the HEX file. A small DOS utility is available form web site called ¡¥REORDER.EXE¡¦. It takes a fragmented file and ¡¥reorders¡¦ it to be in one continuous address block.

 

 

Command description

 

q    bulk programming (i, e, p, v, l1, l2, l3)

The device is automatically chip identified, erased, programmed, verified and locked. Reduce keystrokes when programming multiple devices.

 

i      chip identification

The slave will be identification as AT89C51 or AT89C52, other type of programmable chip is not supported. Only 12V programming voltage is support in this programmer.

 

e     chip erase

      Electrically erase the slave chip; all the data in the slave memory will be erased,  

 

c     read memory

The contents of the selected memory are sent to the host computer in Intel hex format. Turn on input capture or logging in the terminal program before using this command. The resulting .HEX file will have to be edited with a ¡¥plain text¡¦ editor to remove any unwanted command characters or messages.

 

p     program memory

The user will be prompted to ¡§Send file now¡K¡¨. The .HEX file sent to the programmer will be used to program the currently selected memory (AT89C51 or AT89C52) in the device.

 

v     verify memory

The user will be prompted to ¡§Send file now¡K¡¨. The .HEX file sent to the programmer will be used to verify the currently selected memory (AT89C51 or AT89C52) in the device. Verification should be done before writing any lock bits. Devices that have been ¡¥locked¡¦ will not verify correctly.

 

l      write lock bit

      This programs the lock bits, lock bits 1,2,3 will disable the external excution.

 

a     send address

      This will send 12 bits or 13 bits hex address to the slave

 

d     send data

      This will send a 8 bits hex data to the slave

 

w    send write code command

This will send a write code mode to the slave, according the flash programming mode in the AT89C51/  AT89C52 datasheets

 

r     send read code command

This will send a read code mode to the slave, according the flash programming mode in the AT89C51/  AT89C52 datasheets

 

g     get return data value

This will print the states of P0 of master in the screen. After the send the address and read code command, use get return data command to get the data in slave memory

 

t     write all [test mode]

      This function is implemented for testing how long the ale pulse required for programming

      a chip, and see which address the programmer can not be writes. By changing the value of

      ale pulse, it is easily determine what is the valid value for ale pulse.

 

 

How to Use ¡¥term.exe¡¦ Communications Program

 

The programmer  require a communications program to transfer data between the serial port on the PC and the hardware. In Windows 9x there is a comms program called ¡¥Hyperterminal¡¦ already built in.

In Windows 3.1x comes with the ¡¥Terminal¡¦ comms program built in. There are many comms program

you can download from software sites.

 

A DOS-based comms program has written called 'term.exe'.

It is a simple, basic terminal program which does its job without a lot of ¡¥bells & whistles¡¦.

You may download it from http://www.kitsrus.com/zip/term.zip

 

How to install ¡¥term.exe¡¦

 

This is a detailed explanation of how we have installed ¡¥term.exe¡¦ in our Windows 98 system. There are slight

differences with Windows 95 and 2000 but it gives you an idea of how to do it.

 

  1. Unzip ¡¥term.zip¡¦. You will get this file and ¡¥term.exe¡¦.
  2. Move ¡¥term.exe¡¦ to the same folder as Hyperterminal.
    C:\Program Files\Accessories\Hyperterminal
    (We did this because sometimes I use Hyperterminal and all our hex files for programming      firmware are in the same folder.)
  3. Right click on some blank space on the desktop and select "New ® Shortcut".
  4. Click on the "Browse" button and find 'term.exe' on your hard disk in the above mentioned            folder
  5. Click on it and select "open". Click "Next", "Next" then "Finish".

You should now have an icon on your desktop. If you want to change the icon¡¦s name then right click on it and select ¡§Rename¡¨.

  1. Right click on this icon and select "Properties".
  2. Click on the "Program" tab.
  3. Go to the end of the "Cmd line" box and type in " 9600" (you must include the leading space). If you are using COM2 then type " /2 9600" instead. Notice that the ¡§Working¡¨ directory/folder is set to the same as the ¡§Cmd line¡¨. You can change this if necessary.
  4. Tick the ¡§Close on exit¡¨ box. This will shutdown the DOS window when you quit ¡¥term.exe¡¦.
  5. Click on the ¡§Change Icon¡K¡¨ button if you want to change the icon associated with this shortcut.
  6. Click on the ¡§Screen¡¨ tab and select ¡§Full-screen¡¨.
  7. Click "OK".

 

To run ¡¥term.exe¡¦ simply click on the desktop icon.

Now see if you can communicate with the kit.

 

 

Programming with hardware

 

We suggest you put the hex file you want to program into the same folder as term.exe. Then when you do an ¡¥Alt-D¡¦ followed by a ¡¥dir *.hex¡¦ all the hex files will be in the same folder. You will not have to change folders using DOS commands (which an increasing number of people today do not know.) Exit the folder by typing ¡¥exit¡¦ and hitting Enter.

 

Put in the chip to be programmed. The chip identification (i) and erase (e) commands are obvious.

 

To send the hex file to the programmer hit P for program. You will be prompted ¡¥Send file now ¡K¡¦ Now

hit Alt-S which is (press F1) ¡¥Send text file¡¦. Enter the hex file name. You will be prompted for the hex file name. Type it in then press Enter. The file will now be sent to the chip to be programmed on the

programmer. You can do a Verify you will again be prompted to ¡¥Send File Now ¡K¡¦. Just hit Alt-S. The

correct file name is remembered. Hit Enter and the file will be sent to be verified.

 

Finally do the required Lock bit command(s).

 

A Bulk Programming(q)  feature built in which does i, e, p, v, l1, l2, l3. You still have to do the Alt-S to send the file to the Programmer.

 

Contact Us

 

If you have suggestions on how to improve this documentation email us at 01111911D@polyu.edu.hk

July 22, 2003.

- - - - - - - - - - - - - - - - -