Vous êtes sur la page 1sur 15

Microsyst

ems
Design IV
(2015
S2)
Semester Project
Report
Rahman Z, 208063707

Microsystems Design IV (2015 S2)


1) introduction
as per project instructions, we were asked to present a platform upon which we
program an ARM based micro controller to exercise the following skills:
the use of an ARM based micro controller
the use of a serial port to communicate with an external device such as a PC
the use of timers to generate baud rate clocks
the use of ASCII control characters
the use of lookup tables or mathematical functions to calculate values
the use of a basic GUI to represent man-machine interface
using the above mentioned objectives, we were instructed to build platform upon
which we can display a sine wave with modifiable values and use these values to
output a sound.

2) Scope
according to the project description, the platform must perform the following tasks:
a) startup screen:
when the platform starts, it is required to display a splash screen containing our
details such as student name and number (Rahman Z, 208063707). this information
must be visible for 15 seconds
b) Graphical user interface
the GUI is ASCII based and should be shown on a terminal based program on a PC
OS (in this project, we use Real Terminal because its dimensions can be set for size).
the GUI should exhibit creativity through ASCII art and colourful displays.
c) user input
there has to be a form of instructions that can teach the user to operate the device,
the device should use a keyboard for commands, using the tab and enter functions
for updating the table. the variables that are to change are the frequency and
phase.
d) function generator output
a sine wave must be displayed on the function generator output, the frequency and
phase should be displayed and must concur with the wave shown on the graphic
interface. this signal must update when there is a change in data. in our case, we
update it whenever we press enter.
as an example, the following image was provided for reference:

Rahman Z, 208063707

Microsystems Design IV (2015 S2)

Fig: sample graphic output


the above scope has been outlined in the project scope provided by the lecturer and
the following solutions are based on these requirements.

3) Hardware
the first step to solving such a problem is to select an ARM microcontroller upon
which we can program this onto, by much research and suggestions, as well as
employment influence, I had selected the NUCLEO F401RE board which is a
development board manufactured by ST microcontrollers, this board is a flexible and
powerful platform upon which many types of development projects are possible. the
board comes with its own programmer (the ST_LINK_V2), its photo and block
diagram is displayed below:

fig: STM NUCLEO top view

Rahman Z, 208063707

Microsystems Design IV (2015 S2)

Fig: STM NUCLEO block diagram


as seen in the images above, this board requires no external programmer and
connects straight to the USB of the computer. fortunately the ST_LINK_V2
programmer can also be used as a virtual COM port that appears on the computer
as a usable SERIAL PORT.

4) Software
the STM NUCLEO is MBED enabled, MBED is an online IDE that works on the basis of
IOT, this enables us to work on this board from anywhere there is access to the
internet. given the computer has the necessary drivers installed for the ST_LINK_V2
and has their programmers firmware updated. both drivers and firmware upgrade
software is readily available from the STM website. instructions on how to use these
are also available online.
since there is no desktop based software, the entire project can be built in the
online interface, since the device is MBED enabled, this opens a flash device on "my
computer" which acts as a storage device for the program. in the online IDE of
MBED, once you compile, it generates a .bin file that you save onto the Nucleo
storage device and once saved, your board is programmed.
to use this online development environment, the user must register (registration is
free) to receive an online profile. once the profile is created, a platform must be
selected (NUCLEO STM32F401RE), the compiler must be opened and the selected
MBED enabled device will appear as one of the devices belonging to the user. given
the device identity being known by the IDE, a host of functions and declarations
that are used throughout the online environment are modified to work on the
4

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


developers board. this eliminates any setup required to identify the chip or clock
settings that are usually required by general IDEs.
below is an image of the web based IDE, MBED

Fig: the MBED IDE used in Firefox


this compiler can be found in the following address:
https://developer.mbed.org/compiler
once the user has registered.
additional terminal software is required to interface with the board. in this instance,
we shall use Real Terminal, this is a rhobust and flexible software, one limitation to
this software is the lack of ability to change text colour which can be done in Hyper
terminal. but sacrificing this ability allows us a host of other abilities that are not
available in Hyper terminal.

5) Firmware
now that the hardware and software to be used has been determined, the
programming begins. initially the following functions are tested: blinking an LED,
interrupts, serial echo, serial interrupt, PWM etc.
5

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


there are plenty of example code that are able to assist in the basics, as for the
project scope, the following code has been commented for explanatory reasons.
/*---------main.c---------*/
#include "mbed.h"
#include "string.h"
#include "file_repository.h"
//-----------------------------------// Micro systems design
// Zahidur Rahman
// 208063707
//-----------------------------------//definitions
Serial pc(USBTX, USBRX);
#define PI 3.14159
PwmOut sound(PB_4);
//functions
void splash_screen(void);//15 second screen
void home_cursor(void);//takes cursor back to 1;1
void place_cursor(int x, int y);//place cursor in position x and y
void print_frame(char splash[30][70]);//prints box frame around the screen
void print_frequency(void);//updates frequency text
void print_phase(void);//updates phase text
void print_scope(void);//updates scope text
void print_update(void);//updates warning for update
void print_values(void);//prints all values, its a combination of all values
void clear_screen(void);//clears everything
void Rx_interrupt();//function to be attached to the receive interrupt
void print_signal();//prints sine wave on the graph
//global variables used for convenience
//flag to show that the screen has been updated
bool updated = true;
char key;
//frequency ranges from 20Hz to 10kHz; phase shifts from 0 to 180
int frequency, phase;
//screen scope to define the time/div of the screen. sound freq gets updated from
frequency
float screen_scope, sound_freq;
int main()
{
pc.baud(115200);//set to a faster baud, defaults 9600
clear_screen();//clean start
frequency = 20;//initial frequency, lowest
sound_freq = 20;//initial sound frequency
phase = 0;//lowest phase shift
screen_scope = 50.0;//screen scope representation in milli seconds
//splash screen setup before while loop
int i;
while(i < 16)
{
printf("\033[%d;%dm",30+(i%7),47-(i%7));//change colour to match i
wait(1);// for the 15 second splash screen
print_frame(splash_intro);

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


i++;
place_cursor(39,1);
pc.printf("%d", i);
}
printf("\033[%d;%dm",32,40);//change to readable fonts
pc.attach(&Rx_interrupt, Serial::RxIrq);//attach function to serial receive
interrupt
print_frame(splash_frame);//clears screen and prints the GUI
print_values();
while(1)
{
sound.period_us((1000/sound_freq)*1000);
sound.pulsewidth_ms(((1000/sound_freq)/5)*1000);
switch(key)//this is modified on the serial interrupt
{
case 'f'://f for faster
{
updated = false;//new values
if(frequency < 100)//10ms screen scope
{
frequency = frequency + 10;
screen_scope = 50.0;
}
else if(frequency < 1000)//1ms screen scope
{
frequency = frequency + 100;
screen_scope = 5.0;
}
else if(frequency < 10000)//100us screen scope
{
frequency = frequency + 1000;
screen_scope = 0.5;
}
else
{
frequency = 10000;//resets frequency to minimum
}
print_frequency();
print_update();
home_cursor();
break;
}
case 's'://s for slower
{
updated = false;//new values
if(frequency > 1000)//10ms screen scope
{
frequency = frequency-1000;
screen_scope = 0.5;
}
else if(frequency > 100)//1ms screen scope
{
frequency = frequency - 100;
screen_scope = 5;
}
else if(frequency > 20)//100us screen scope
{
frequency = frequency - 10;
screen_scope = 50;
}
else
{
frequency = 20;//resets frequency to minimum

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


}
print_frequency();
print_update();
home_cursor();
break;
}
case 'l'://l for late
if(phase<180)
{
phase = phase+5;
}
else
{
phase = 180;
}
print_phase();
updated = false;
print_update();
home_cursor();
break;
case 'e'://e for early
if(phase>0)
{
phase = phase - 5;//wont go above 10
}
else
{
phase = 0;//cant go below 0
}
print_phase();
updated = false;
print_update();
home_cursor();
break;
case 0x09://tab
break;
case 0x0D://enter
{
updated = true;//enter updates and prints the graph
sound_freq = frequency;
clear_screen();
print_frame(splash_frame);
print_values();
break;
}
}
key = '0';
home_cursor();
}
}
void print_frame(char splash[30][70])//note that this clears screen
{
int x, y;
char x_line[70];
home_cursor();
for(y = 0; y<30; y++)
{
for(x = 0; x<70; x++)
{
x_line[x] = splash[y][x];
}

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


place_cursor(1, y);//beginning of every line
pc.printf(x_line);
//pc.printf("\n\r");
}
}
void place_cursor(int x, int y)//a go to function to find coordinates
{
pc.printf("\033[%d;%dH",y,x);//row;column
}
void home_cursor(void)//function to find 1;1
{
place_cursor(1,1);
}
void clear_screen(void)//clears everything
{
pc.printf("\f");//form feeds screen
home_cursor();
}
void print_update(void)//this prints a warning to the user as a notifier
{
if(!updated)
{
place_cursor(26,28);
pc.printf("Hit ENTER to update!");
}
else
{
place_cursor(26, 28);
pc.printf("
");
}
}
void print_frequency(void)//updates frequency from global variable
{
place_cursor(13,28);
if(frequency<1000)
{
pc.printf("%3d", frequency);
}
else if(frequency<10000)
{
place_cursor(13,28);
pc.printf("%2dk",frequency/1000);
}
else if(frequency<10001)
{
place_cursor(12,28);
pc.printf(" %dk",frequency/1000);
}
else
{
pc.printf("xxx");//error detection
}
home_cursor();
}
void print_scope(void)//updates scope from global variable
{
place_cursor(42,26);

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


printf("%2.2f",screen_scope);
}
void print_phase(void)//updates phase from global variable
{
place_cursor(65,28);
pc.printf("%3d",phase);
}
void print_values(void)//prints all values onto the screen as a refresh
{
print_frequency();
print_phase();
print_scope();
print_update();
print_signal();
home_cursor();
}
void print_signal(void)//function used to plot sin graph
{
int x;
float y;
for(x = 0; x<66; x++)//4 characters used on the boarders
{
y = sin((((2*PI*frequency*(screen_scope/1000))/65)*x)+((PI/180)*phase))*10;
place_cursor(x+3, 14-y);
pc.putc('*');
}
home_cursor();
}
void Rx_interrupt()//Function used to update global key variable
{
while(pc.readable())
{
key = pc.getc();
}
return;
}
/*--------end of file--------*/

as shown in the above code, an extra file was included, the file_repository header
file was used to store the arrays for the splash screen and frame. the files text is
shown below:
/*--------file_repository.h--------*/
char splash_frame[30][70] = {
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','
_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_
','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_'
,'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ','R','A','H','M','A','N',',','Z',' ','2','0','8','0','6','3','7','0','7',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','E','l','P',':','
','(','F',')','a','s','t',' ',';',' ','(','S',')','l','o','w',' ',';','
','(','E',')','a','r','l','y',' ',';',' ','(','l',')','a','t','e',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ','|'
,'|','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','
_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','|'

10

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


,'|','+','y',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','
_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','x','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','|',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','|'
,'|','-','y','<','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-',
'S','c','r','e','e','n',' ','T','|','m','e','/','D','|','v',':',' ',' ',' ',' ',' ','
','m','s','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','>','|'

11

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


,'|','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','
_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','|'
,'|',' ','F','r','e','q','u','n','c','y',':',' ',' ',' ',' ','H','z',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ','P','h','a','s','e',':',' ',' ',' ',' ',' ',' ','|'
,'|','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','
_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','|'
};
char splash_intro[30][70] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ','_','_','_','_','_',' ',' ',' ',' ',' ',' ',' ',' ',' ','_',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ','_','_','_','_','_','_',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ','|',' ',' ','_','_',' ','\\',' ',' ',' ',' ',' ',' ',' ','|',' ','|',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ','|','_','_','_',' ',' ','/',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ','|',' ','|','_','_',')',' ','|',' ','_','_',' ','_',' ','|',' ','|','_','_','
',' ',' ','_',' ','_','_',' ','_','_','_',' ',' ',' ',' ','_','_',' ','_',' ',' ','_','
','_','_',' ',' ',' ',' ',' ',' ','/',' ','/',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ','|',' ',' ','_',' ',' ','/',' ','/',' ','_','`',' ','|','|',' ',' ','_','
','\\',' ','|',' ',' ','_',' ','`',' ','_',' ','\\',' ',' ','/',' ','_','`',' ','|','|',' ','
','_',' ','\\',' ',' ',' ',' ','/',' ','/',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ','|',' ','|',' ','\\',' ','\\','|',' ','(','_','|',' ','|','|',' ','|','
','|',' ','|','|',' ','|',' ','|',' ','|',' ','|',' ','|','|',' ','(','_','|',' ','|','|','
','|',' ','|',' ','|',' ',' ','/',' ','/','_','_',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',
' ',' ',' ',' ',' ','|','_','|',' ',' ','\\','_','\\','\\','_','_',',','_','|','|','_','|','
','|','_','|','|','_','|',' ','|','_','|',' ','|','_','|','
','\\','_','_',',','_','|','|','_','|',' ','|','_','|',' ','/','_','_','_','_','_','|',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ','_','_','_',' ',' ',' ',' ','_','_','_',' ',' ',' ',' ','_','_','_',' ','
',' ',' ','_','_','_',' ',' ',' ',' ',' ','_','_',' ',' ','_','_','_','_',' ','
','_','_','_','_','_','_',' ',' ','_','_','_',' ',' ','_','_','_','_','_','_',' ',' ',' ',' ','
',' ',
' ',' ',' ',' ',' ','|','_','_',' ','\\',' ',' ','/',' ','_',' ','\\',' ',' ','/',' ','_','
','\\',' ',' ','/',' ','_',' ','\\',' ',' ',' ','/',' ','/',' ','|','_','_','_','
','\\','|','_','_','_','_',' ',' ','|','/',' ','_',' ','\\','|','_','_','_','_',' ',' ','|',' ','
',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',')',' ','|','|',' ','|',' ','|',' ','|','|',' ','(','_',')','
','|','|',' ','|',' ','|',' ','|',' ','/',' ','/','_',' ',' ',' ','_','_',')',' ','|',' ',' ','
','/',' ','/','|',' ','|',' ','|',' ','|',' ',' ',' ','/',' ','/',' ',' ',' ',' ',' ',' ',

12

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


' ',' ',' ',' ',' ',' ',' ','/',' ','/',' ','|',' ','|',' ','|',' ','|',' ','>',' ','_',' ','<','
','|',' ','|',' ','|',' ','|','|',' ',' ','_',' ','\\',' ','|','_','_',' ','<',' ',' ',' ','/','
','/',' ','|',' ','|',' ','|',' ','|',' ',' ','/',' ','/',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ','/',' ','/','_',' ','|',' ','|','_','|',' ','|','|',' ','(','_',')','
','|','|',' ','|','_','|',' ','|','|',' ','(','_',')',' ','|','_','_','_',')',' ','|',' ','/','
','/',' ',' ','|',' ','|','_','|',' ','|',' ','/',' ','/',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ','|','_','_','_','_','|',' ','\\','_','_','_','/',' ','
','\\','_','_','_','/',' ',' ','\\','_','_','_','/',' ','
','\\','_','_','_','/','|','_','_','_','_','/',' ','/','_','/',' ',' ',' ','
','\\','_','_','_','/',' ','/','_','/',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
};
/*--------end of file--------*/

the above file is quite difficult to understand, but once the splash function is
understood, generating a file like this becomes much more clearer.

6) outcome
with the above code programmed into a STM nucleo board, we plug in the usb port
and a virtual port opens up. using Real Terminal, we set the following:

under the display tab, set the rows to 30 and the columns to 70. also select
ANSI as the display text.
under port, select the correct USB COM port, set the baud rate to 115200,
click on "open" twice, this will refresh the screen.
since the board is already powered, you will need to press the reset button on
the board to restart the application from start. press the black button on your
nucleo

if all goes well, we are able to see an outgoing wave that looks as follows:

13

Rahman Z, 208063707

Microsystems Design IV (2015 S2)

fig: an updating splash screen animated to change colours

Fig: initial conditions graph display

14

Rahman Z, 208063707

Microsystems Design IV (2015 S2)


7) Bibliography
much of the work done in this project is done from past experience based on Digital
systems I, II and III.
despite preknowledge, there was extensive research done in finding resources for
this project. all of which are online, below are the websites with information on how I
was able to produce this project.
https://developer.mbed.org/
https://www.mbed.com/en/
http://www.carminenoviello.com/
http://www.openstm32.org/HomePage
https://www.youtube.com/watch?v=-bb--fYWqt4
http://www.st.com/web/catalog/tools/FM116/CL1620/SC959/SS1532/LN1847/P
F260000?s_searchtype=partnumber#
Google searches
o MBED example codes
PWM
Serial
Blink LED
Interrupts
ASCII

end of report

15

Rahman Z, 208063707

Vous aimerez peut-être aussi