8/13/2019 m.tech Es Lab Manual
1/47
ABOUT KEILVISION SOFTWARE
CONFIGURING KEIL VISION3
Abstract: This article gives a step-by-step procedure for starting a project and configuring the
Keil Vision IDE software for the MAX7651 EV kit. It is the second of a three-part application
example for writing, compiling and downloading a simple program to the MAX7651 EV kittarget board.
Procedure
1. Download and install the Keil DK-51 demo software atwww.keil.comunless it wasinstalled previously as a step in application note 3083, "Performing ADC Conversions
Using the MAX7651." Note: Please verify that you are using version 7.08 or later. The
procedure for the software installation is outlined in the MAX7651 Quick Start Manual.
2. Open Keil Vision 2 by clicking on the Keil icon on your desktop or by opening thesoftware in the Windows START menu.
Open a new project in the Keil Vision IDE Software
Select a new folder and give the project a name.
Select MAX7651 target in the database under Maxim -> MAX7651.ClickOK.
Click Yes, to "Copy Standard 8051 Startup Code to Project Folder and Add File toProject".
Right Click on Target 1 ->SourceGroup 1 and Add files to Source Group 1.
http://www.keil.com/http://www.keil.com/http://www.keil.com/http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.keil.com/8/13/2019 m.tech Es Lab Manual
2/47
1. Add the source files. See, application note 3083, "Performing ADC Conversions Usingthe MAX7651."
Set Target Options. Click on the icon to the left of Target drop down box. Click on the Target
Tab. Configure the Target for an 11.0592MHz crystal, select Use On-ChipROM(0x0-0x3FFF),
specify Off-chip Code Memory to Start at 0x4000 with a size of 0x8000 and Off-Chip Xdata
memory to Start at 0x0 with a Size of 0x8000.
http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/30838/13/2019 m.tech Es Lab Manual
3/47
1.2. Set output options. Click on Create HEX file.
8/13/2019 m.tech Es Lab Manual
4/47
Set Debug Options. Check the Use Simulator option.
3. Click OK to accept option changes.4. In the Project Menu, Select Rebuild all Target Files. The Program should compile.5. Make sure there are no errors. The Program is ready to be loaded to the MAX7651 Target
Board. See, application note 3087, "Downloading a Program to Flash Using the
MAX7651 EV Kit Serial Downloader."
6. If you do not have the MAX7651EVKIT and/or wish to run the program using the KeilVision simulator, click on the Debug Menu, and Start the debug Session. Click OK forthe warning of evaluation version. Select View Menu and click on Serial Window #1.
Select the Debug Menu and click on Go. The program will execute and perform analog-
http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/30878/13/2019 m.tech Es Lab Manual
5/47
to-digital conversions on all 8 channels.
8/13/2019 m.tech Es Lab Manual
6/47
8/13/2019 m.tech Es Lab Manual
7/47
Hyper Terminal Window Setup
8/13/2019 m.tech Es Lab Manual
8/47
Flash Magic provides a clear and simple user interface to these features and more asdescribed in the following sections. Under Windows, only one application may haveaccess the COM Port at any one time, preventing other applications from using theCOM Port. Flash Magic only obtains access to the selected COM P ort when ISP
operations are being performed. This means that other applications that need to usethe COM Port, such a s debugging tools, may be used while Flash Magic is loaded.
Programming ModeSwitch Push to ON, MCU enters programming mode.
Execution ModeSwitch Push to OFF, MCU turns to execution mode.
On-board PeripheralsThe Development board comes with many interfacing options
8 Nos. of Point LEDs 8-Input DIP Switch 2 Lines X 16 Character LCD Display. Real Time Clock with battery backup. 8 Channel, 10- Bit Analog to Digital Converter. 4 Nos. of Seven-segment display. RS232 Serial Interface. Digital Temperature Sensor 32k External SRAM/Flash
8/13/2019 m.tech Es Lab Manual
9/47
4 X 4 Matrix keyboard. Motor driver circuit. Alarm interface
8/13/2019 m.tech Es Lab Manual
10/47
ABOUT KEILVISION SOFTWARE
CONFIGURING KEIL VISION3Abstract: This article gives a step-by-step procedure for starting a project and configuring
the Keil Vision IDE software for the MAX7651 EV kit. It is the second of a three-part
application example for writing, compiling and downloading a simple program to theMAX7651 EV kit target board.
Procedure
7. Download and install the Keil DK-51 demo software atwww.keil.comunless it wasinstalled previously as a step in application note 3083, "Performing ADC Conversions
Using the MAX7651." Note: Please verify that you are using version 7.08 or later.
The procedure for the software installation is outlined in the MAX7651 Quick Start
Manual.
8. Open Keil Vision 2 by clicking on the Keil icon on your desktop or by opening thesoftware in the Windows START menu.9. Open a new project in the Keil Vision IDE Software
10.Select a new folder and give the project a name.11.Select MAX7651 target in the database under Maxim -> MAX7651.ClickOK.12.Click Yes, to "Copy Standard 8051 Startup Code to Project Folder and Add File to
Project".
13.Right Click on Target 1 ->SourceGroup 1 and Add files to Source Group 1.
http://www.keil.com/http://www.keil.com/http://www.keil.com/http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Source/gpk/1079http://www.maxim-ic.com/glossary/definitions.mvp/term/Click-and-Pop/gpk/886http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.keil.com/8/13/2019 m.tech Es Lab Manual
11/47
14.Add the source files. See, application note 3083, "Performing ADC ConversionsUsing the MAX7651."
15.Set Target Options. Click on the icon to the left of Target drop down box. Click onthe Target Tab. Configure the Target for an 11.0592MHz crystal, select Use On-ChipROM(0x0-0x3FFF), specify Off-chip Code Memory to Start at 0x4000 with a size of
0x8000 and Off-Chip Xdata memory to Start at 0x0 with a Size of 0x8000.
http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/glossary/definitions.mvp/term/ROM/gpk/720http://www.maxim-ic.com/app_notes/index.mvp/id/3083http://www.maxim-ic.com/app_notes/index.mvp/id/30838/13/2019 m.tech Es Lab Manual
12/47
16.Set output options. Click on Create HEX file.
17.Set Debug Options. Check the Use Simulator option.
8/13/2019 m.tech Es Lab Manual
13/47
18.Click OK to accept option changes.19.In the Project Menu, Select Rebuild all Target Files. The Program should compile.20.Make sure there are no errors. The Program is ready to be loaded to the MAX7651
Target Board. See, application note 3087, "Downloading a Program to Flash Using
the MAX7651 EV Kit Serial Downloader."
21.If you do not have the MAX7651EVKIT and/or wish to run the program using theKeil Vision simulator, click on the Debug Menu, and Start the debug Session. Click
OK for the warning of evaluation version. Select View Menu and click on Serial
Window #1. Select the Debug Menu and click on Go. The program will execute andperform analog-to-digital conversions on all 8 channels.
http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/3087http://www.maxim-ic.com/app_notes/index.mvp/id/30878/13/2019 m.tech Es Lab Manual
14/47
8/13/2019 m.tech Es Lab Manual
15/47
ABOUT FLASH MAGIC
FLASH PROGRAMMING UTILITY
1. NXP (Philips)
NXP Semiconductors produce a range of Microcontrollers that feature both on-chip
Flash memory and the ability to be reprogrammed using In-System Programmingtechnology. Flash Magic is Windows software from the Embedded Systems
Academy (www.flashmagictool.com) that allows easy access to all the ISP features
provided by the devices.
These features include:
Erasing the Flash memory (individual blocks or the whole device)
Programming the Flash memory
Modifying the Boot Vector and Status Byte
Reading Flash memory,
Reading the signature bytes
Performing a blank check on a section of Flash memory
Reading and writing the security bits
8/13/2019 m.tech Es Lab Manual
16/47
Hyper Terminal Window Setup
8/13/2019 m.tech Es Lab Manual
17/47
Flash Magic provides a clear and simple user interface to these features and more asdescribed in the following sections. Under Windows, only one application may haveaccess the COM Port at any one time, preventing other applications from using the
COM Port. Flash Magic only obtains access to the selected COM P ort when ISPoperations are being performed. This means that other applications that need to use
the COM Port, such a s debugging tools, may be used while Flash Magic is loaded.
Programming ModeSwitch Push to ON, MCU enters programming mode.
Execution ModeSwitch Push to OFF, MCU turns to execution mode.
On-board PeripheralsThe Development board comes with many interfacing options
8 Nos. of Point LEDs 8-Input DIP Switch 2 Lines X 16 Character LCD Display. Real Time Clock with battery backup. 8 Channel, 10- Bit Analog to Digital Converter. 4 Nos. of Seven-segment display. RS232 Serial Interface. Digital Temperature Sensor 32k External SRAM/Flash 4 X 4 Matrix keyboard. Motor driver circuit. Alarm interface
8/13/2019 m.tech Es Lab Manual
18/47
Board layout
8/13/2019 m.tech Es Lab Manual
19/47
8/13/2019 m.tech Es Lab Manual
20/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE:
___________________________________________________________________________
Aim:Write a C program to send data serially through serial port.
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3,flash magic
Program:
#include
#include
void serial_init(void);
void serial_init(void)
{
SCON=0X50;
TMOD=0X20;
TH1=0XFD;
TR1=1;
TI=1;
}
void main(void){
serial_init();
while(1)
printf("Hello! world\n");
}
8/13/2019 m.tech Es Lab Manual
21/47
8/13/2019 m.tech Es Lab Manual
22/47
Output:
Result:
Thus the program to send data serially through serial port was executedsuccessfully and got the desired output.
8/13/2019 m.tech Es Lab Manual
23/47
8/13/2019 m.tech Es Lab Manual
24/47
8/13/2019 m.tech Es Lab Manual
25/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE:
Aim: Write a program for the LED to glow from right to left.
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3, flashmagic
Program:
#include
void delay();void main()
{
int i;while(1)
{
for(i=0x01;i
8/13/2019 m.tech Es Lab Manual
26/47
Output:
Result:
Thus the program the LED to glow from right to left serial port was
executed successfully and got the desired output.
8/13/2019 m.tech Es Lab Manual
27/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE:
Aim:Write a C program to display a message on LCD.
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3,flashmagic
Program:
#include
#include
#define data P1sbit RS=P3^5;
sbit RW=P3^6;sbit EN=P3^7;
code unsigned char msg[]=("WELCOME 2 JBREC");
code unsigned char msg1[]=("ES");
void lcd_init(void);
void lcd_cmd(unsigned char);
void lcd_display(unsigned char);void delay(int);
void lcd_cmd(unsigned char cmd)
{data=cmd;RS=0;
RW=0;
EN=1;delay(35);
EN=0;
}
8/13/2019 m.tech Es Lab Manual
28/47
8/13/2019 m.tech Es Lab Manual
29/47
Output:
Result:
Thus the program to display a message on LCD was executed successfully
and the following message is displayed on LCD.
WELCOME 2 JBREC
ES
8/13/2019 m.tech Es Lab Manual
30/47
8/13/2019 m.tech Es Lab Manual
31/47
{int i;for(i=0;i
8/13/2019 m.tech Es Lab Manual
32/47
Output:
8/13/2019 m.tech Es Lab Manual
33/47
Result:
Thus the program to display value in Port1 is converted to decimal value andObtained desired results.
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE::
Aim:Write a C program to Digital to Analog Conversion
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3,flashmagic
Program:
#include
sfr dacdata=0X90;
void main()
{
unsigned char pulse[13]={128,192,238,255,238,
192,128,64,17,0,17,64,128};
8/13/2019 m.tech Es Lab Manual
34/47
unsigned char x;
dacdata=0X00;
while(1)
{
for(x=0;x
8/13/2019 m.tech Es Lab Manual
35/47
Result:
Thus the program to display digital value converted in to Analog value andObtained desired results.
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
8/13/2019 m.tech Es Lab Manual
36/47
Expt. No: Date: ...........................
TITLE::
Aim:Write a C program to to read data from keypad interface and display on LCD.
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3,flashmagic
Program:
#include
#include
#define DATA P1
void lcd_init(void);void lcd_cmd(unsigned char);
void lcd_display(unsigned char);void Key_Scan(void);void DelayMs(int);
sbit RS = P3^5;
sbit RW = P3^6;sbit lcd_e = P3^7;
unsigned char R,C,ch,d=0x81;
unsigned int i=0;
unsigned char Key[4][4] = {'C','D','E','F','8','9','A','B','4','5','6','7','0','1','2','3',};code unsigned char msg[] = ("KEYPAD TEST PGM ");
code unsigned char msg1[] = ("PRES ANY KEY... ");
void main()
{
lcd_init();
DelayMs(20);lcd_cmd(0x01);
lcd_e=0;
lcd_cmd(0x80);
while(1)
{
Key_Scan();lcd_e=1;
DelayMs(5);
ch = Key[R][C];DelayMs(5);
lcd_cmd(d++);
DelayMs(10);P2=0xFF;
8/13/2019 m.tech Es Lab Manual
37/47
8/13/2019 m.tech Es Lab Manual
38/47
lcd_e = 1;DelayMs(15);lcd_e = 0;
}
void lcd_init(void){
unsigned char i;
lcd_cmd(0x38);DelayMs(15);
lcd_cmd(0x0c);
DelayMs(15);lcd_cmd(0x06); DelayMs(15);
lcd_cmd(0x01); DelayMs(15);
lcd_cmd(0x80); DelayMs(15);
i=0;
while(msg[i]!='\0'){
lcd_display(msg[i]);i++;
}
DelayMs(20);lcd_cmd(0xc0);
i=0;
while(msg1[i]!='\0'){
lcd_display(msg1[i]);i++;
}DelayMs(30);
}
void DelayMs(int k){
unsigned int a,b;
for(a=0;a
8/13/2019 m.tech Es Lab Manual
39/47
Output:
Result:
Thus the program to display value given at keypad interface and displayed on LCDpanel.
8/13/2019 m.tech Es Lab Manual
40/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE::
Aim:Write a C program to read data from keypad interface and display on LCD using ARM
processor.
Equipment Required:Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3,flashmagic
Program:
#include #include
#include "Keypad.h"
extern void Delay(void);
unsigned char Row_Data, Col_Data;unsigned char Msg[4][4] = { '0','1','2','3', '4','5','6','7', '8','9','A','B',
'C','D','E','F'};void Delay(void){
unsigned int i,j;
for(i=0;i
8/13/2019 m.tech Es Lab Manual
41/47
Delay();KeyScan(&IOPIN1/*KeyPad Port*/,16/*Starting Data Pin D0*/,
&Row_Data/*Addr of Row*/,&Col_Data/*Addr of Col*/);
if (Row_Data < 4 && Col_Data < 4)
{
U0THR = Msg[Row_Data][Col_Data];Delay();
Delay();
U0THR = '\n'; } } }
Output:
Result:
Thus the program to display value given at keypad interface and displayed on LCD
panel.
8/13/2019 m.tech Es Lab Manual
42/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE:
Aim: Write a C program to receive data serially.
Equipment Required:
Hardware: Personnel Computer,microcontroller kit
Software: Keil Vision3, flashmagic
Program:
#define CR 0x0D
#include
void init_serial (void);int putchar (int ch);
int getchar (void);
unsigned char test;int main(void)
{
char *Ptr = "*** UART0 Demo ***\n\n\rType Characters to be echoed!!\n\n\r";VPBDIV = 0x02;
init_serial();
while(1)
{while (*Ptr)
{
putchar(*Ptr++);}
putchar(getchar());
}
}
8/13/2019 m.tech Es Lab Manual
43/47
void init_serial (void){PINSEL0 = 0x00000005;
U0LCR = 0x00000083;
U0DLL = 0x000000C3;
U0LCR = 0x00000003;}
int putchar (int ch)
{if (ch == '\n')
{
while (!(U0LSR & 0x20));
U0THR = CR;
}
while (!(U0LSR & 0x20));
return (U0THR = ch);}
int getchar (void){
while (!(U0LSR & 0x01));
return (U0RBR);
}
8/13/2019 m.tech Es Lab Manual
44/47
Output:
Result:Thus the program to receive data serially was executed successfully and got
the desired output.
8/13/2019 m.tech Es Lab Manual
45/47
DEPARTMENT OF..................................................................................................................
........................................................................................................................LABORATORY
Expt. No: Date: ...........................
TITLE:
Aim:Write a C program to send data serially through serial port using ARM processor.
Equipment Required:
Hardware: Personnel Computer, Microcontroller KitSoftware: Keil Vision3, Flashmagic
Program:
#pragma INTERWORK
#include
#define CR 0x0D
void init_serial (void)
{
PINSEL0 = 0x00050000;U1LCR = 0x83;
U1DLL = 97;
U1LCR = 0x03;}
int putchar (int ch){
8/13/2019 m.tech Es Lab Manual
46/47
if (ch == '\n'){
while (!(U1LSR & 0x20));
U1THR = CR;
}
while (!(U1LSR & 0x20));return (U1THR = ch);
}
int getchar (void)
{
while (!(U1LSR & 0x01));return (U1RBR);
}
Output:
Result:
8/13/2019 m.tech Es Lab Manual
47/47
Thus the program to send data serially through serial port was executedsuccessfully and got the desired output.