DT-51 AT89C51XXX BMS Application Note By: IE Team This Application Note (AN) serves as a tutorial of how to use the DT-51 AT89C51XXX Bootloader Micro System along with its supplementary software. The layout of DT-51 AT89C51XXX BMS is as follows: Picture1 The layout of DT-51 AT89C51XXX BMS Hardware preparation for DT-51 AT89C51XXX BMS is as follows: 1. Arrange jumper J18 and J19 on position 1-2 so that P3.0 and P3.1 function as a serial communication line. 2. Arrange jumper J13, J14, J15, J16, and J17 so that it uses the USB line for bootloader or RS-232 line for bootloader. 3. Connect the USB cable to the module and PC if using USB as bootloader, or connect the serial cable to the PC COM port and the RJ45 connector to the module if using RS232 line for bootloader. 4. If there is another module that will be connected to the DT-51 AT89C51XXX BMS, it is advised to connect the module to the DT-51 AT89C51XXX BMS first. Pay attention to the connection, especially for the VCC and GND line, do not put it in reverse. 5. Arrange jumper J4 on position 1-2 (power source from VEXT) and release jumper J5 (5V). 6. Connect a 6-12 VDC Power Supply to the VEXT connector to give power to the module. Page 1 of 17
The setup process for BASCOM-8051 demo is as follows: 1. BASCOM-8051 are included inside the CD/DVD that comes along with the module. The setupdemo.exe file is located in the BASCOM-8051 folder. Run the setupdemo.exe to start the installation process. 2. The initial display of BASCOM-8051 installer. Click Next > to continue the installation process. Picture 2 BASCOM-8051 initial installation screen 3. Proceed to the License Agreement. Click I accept the agreement and then click Next > to agree with the terms and continue with the installation process. Picture 3 BASCOM-8051 License Agreement Page 2 of 17
4. At the information screen, click Next > to proceed with the installation. Picture4 Information Screen 5. At the Select Destination location screen, click Next > to proceed with the installation. Picture 5 Select Destination Location Screen Page 3 of 17
6. At the Select Start menu folder, click Next > to proceed with the installation. 8. BASCOM-8051 demo installation process. Picture 6 Select Start Menu Folder Screen Picture 7 BASCOM-8051 Demo Installation Process Page 4 of 17
9. At the Additional Files installation screen, click Next > to proceed with the installation. Picture 8 Additional Files Installation Screen 10. After the process is completed, click Yes, restart the computer now and click Finish. Picture 9 Completing the BASCOM-8051 Setup Wizard Screen 11. Inside the BASCOM-8051 folder in the CD/DVD, look for the 89C51ID2.DAT. Copy this file to the BASCOM-8051 folder (Example: C:\Program Files\MCS Electronics\BASCOM8051demo13). This file contains the registry address for the AT89C51ID2 microcontroller. Page 5 of 17
The steps to make a simple application using BASCOM-8051 demo is as follows: 1. Basic interface of BASCOM-8051 demo and the available menu. Min menu Quick menu Picture10 Basic interface of BASCOM-8051 Demo 2. Create a new file through the main menu, select File, and then New. It can also be done using the quick menu Create new file. Picture11 Creating A New File Page 6 of 17
3. Now we will look at the programming form to write the Listing Programs. BASCOM-8051 demo's programming language is based on BASIC. Programming Form Picture 12 Programing Form 4. The Parameters of the Program (chip type, compiler results, etc.) must be set first. This configuration is performed by selecting the Options menu, and then Compiler until 5 sub menus appear as shown in the picture. Compiler Setting Compiler Sub menu 5. To configure the device using the sub menu above. Picture13 Compiler Setting Output is used to set the output type after the program compiles it. Communication is used to set the USART on the device. Such as baudrate and frequency. I2C is used to set the I 2 C communication features on the device. LCD is used to set the device if you want to access the LCD. Misc is used to select the chip type. After all the settings have been done, click the OK button to end the process. Page 7 of 17
Picture 14 BASCOM-8051 Option Settings Screen 6. As an example of an application program, we will discuss about testboard.hex a program which is also included inside the CD/DVD. The device feature that will be used in this program is the USART serial communication. USART is used to perform a serial communication with the computer. The following is an explanation of the testboard.bas program. $regfile = "89C51ID2.DAT" $ramstart = 0 $ramsize = 768 $baud = 9600 $crystal = 11059200 Dim I As Integer Dim C As Byte P0 = 0 P1 = 0 P2 = 0 P3 = 3 Pi2 = 0 Do Inputbin C If C = "A" Then Print "DT-51 BMS,Innovative Electronics" Elseif C = "B" Then Print "Test Port,P0=FF,P1=FF,P2=FF,P3=FF,PI2=FF" P0 = 255 P1 = 255 P2 = 255 P3 = 255 Pi2 = 255 Wait 1 Page 8 of 17
Loop Print "Test Port,P0=00,P1=00,P2=00,P3=03,PI2=00" P0 = 0 P1 = 0 P2 = 0 P3 = 3 Pi2 = 0 Wait 1 End If In this Program, Variable I is initialized as integer, and C as byte. At the beginning of the program, the device waits for serial data input from the computer. If the content of variable C is the character 'A', then the device will send string data DT-51 BMS, Innovative Electronics to the computer. But if the C Variable is filled with the character B, then the device will send string data Test Port,P0=..,P1=..,P2=..,P3=..,PI2=.. along with the activation and deactivation of the Port on the device with a delay of 1 second. 7. The next step is to compile the program that we have just created. This process is done by converting the listing program into a HEX or BIN file. This process is located in the Program Compile tab and can also be accessed by pressing F7 on the keyboard. Picture 15 Compile Menu 8. After selecting the compile command, the following form will appear. Picture 16 Compiling Process If the created listing program does not contain any kind of mistakes (including syntax or formula writing) and doesn't encounter any errors during the compiling process, then BASCOM-8051 demo will automatically creates a HEX (*.hex) file. This HEX file is placed inside the same folder where the BAS (*.BAS) file is stored. Page 9 of 17
Flip 3.3.1 is a software from Atmel that supports microcontroller programming of the MCS family through the bootloader. Flip 3.3.1 is used in microcontroller programming by utilizing a self-programming method on the DT-51 AT89C51XXX BMS. This software is included inside the CD/DVD that comes along with the module. 1. The initial display of Flip 3.3.1. Click Next > to continue the installation process. Picture 17 Flip 3.3.1 Initial Installation Screen 2. Proceed to the License Agreement. Click I accept the terms in the License Agreement and then click Next > to agree with the terms and continue with the installation process. Picture 18 Flip 3.3.1 License Agreement Page 10 of 17
3. Choose the Install Location of Flip 3.3.1, and click Next >. 4. Pick or create a Start menu folder, and click Install. Picture 19 Choose Install Location Screen Picture 20 Choose Start Menu Folder Screen Page 11 of 17
5. Flip 3.3.1 installation process. After the process is completed, click Next >. 6. After the process is completed, click Finish. Picture 21 Flip 3.3.1 Installation Process Screen Picture 22 Completing the Flip 3.3.1 Setup Wizard Screen Page 12 of 17
7. The interface of Flip 3.3.1 and the explanation of its functions. Connection Settings Device Selection Selected Device Operation Flow Buffer Flash Size Start Application Button Run Button Select EEPROM Button Picture 23 Flip 3.3.1 Main Interface Reset Device Connection Status 8. Select the device that will be connected with the program before the device is physically connected and click OK. Picture 24 Device Selection Page 13 of 17
9. Configure Flip 3.3.1 through Settings, and then Preferences..., the following display will appear. To make sure the configuration for Flip 3.3.1 is correct, click the red circled options shown in the picture below. This is done to ensure the active logic in COM PORT RTS pin activates the PSEN pin on DT-51 AT89C51XXX BMS and DTR pin on the COM PORT to control the DT-51 AT89C51XXX BMS RESET pin. Picture 25 RS-232 Configuration 10. Open the Flip 3.3.1. serial connection. This step is used to choose the COM PORT that will be used, and the baudrate to activate the connection between Flip 3.3.1 with the chosen device of the previous step. Picture 26 RS-232 Serial Connection Page 14 of 17
11. Select the COM PORT that will be used, then set baudrate at 19200, and click Connect to connect the device with Flip 3.3.1. Picture 27 RS-232 COM PORT and Baudrate Configuration 12. If no error occurs during the process then the following display will appear. Activate the RESET checkbox next to the Start Application button so that the applications may run correctly. Picture 28 Flip 3.3.1 Main Interface Page 15 of 17
13. Open the compiled testboard.hex file, by selecting File and then Load HEX File... (Ctrl+L). Start the programming process by clicking Run. Make sure all of the options above the Run is already checked. This is recommended for programming process flow using Flip 3.3.1. Picture 29 Load HEX File 14. After the programming process, click Start Application to enter application mode. Don't forget to check the Reset option next to Start Application button first, or press the reset button on the DT-51 AT89C51XXX BMS after the programming process to make sure the DT-51 AT89C51XXX BMS exits bootloader mode. 15. To test the programing results of the testboard.hex file, run the TESTBOARD.exe program included in the CD/DVD that comes along with the DT-51 AT89C51XXX BMS. The following is the interface of TESTBOARD.exe and its functions. Picture 30 TESTBOARD.exe Interface 16. The next step is to select the COM port that will be used to run TESTBOARD.exe. Page 16 of 17
17. Click the Send Character 'A' button. If the serial communication is successfully connected, it will display a green colored text sent from the DT-51 AT89C51XXX BMS. If it is not correctly connected then a red text will be displayed along with a pop up window showing Serial Rx Timeout!. Picture 31 Serial Test 18. The pulse generated after sending character 'B' can be seen in Port 0, Port 1, Port 2, Port 3 (except for P3.0 and P3.1), and Port I2 using oscilloscope, voltmeter, or connected directly with a series of LEDs or DT-I/O LED LOGIC TESTER which will blink one after another. Happy Innovating! BASCOM-8051 is copyright by MCS Electronics. FLexible In-system Programmer is copyright by Atmel Corporation. Page 17 of 17