3.7 Simulation
/
Name :
1
D e s c r i p t i o n : Counter on GPIOB
Version :
# include
s t m 3 2 f 1 0 x l i b . h
# include "STM32_Init.h"
6
i n t main ( void )
i n t i , j = 0 ;
s t m 3 2 I n i t ( ) ;
11
while ( 1 )
j ++;
i f ( j ==1000)
GPIOB
ODR = ( GPIOB
j = 0 ;
16
i f ( i ==0xFFFF ) i = 0 ;
i ++;
21
3.7 Simulation
Before we download the project to the development board we'll do a simulation in Vision3 to
see if everything works. Therefore click on Debug
open the debug mode and show a warning that you are using the evaluation mode. Click OK and
open the GPIOB port with Peripherals
Figure
3.7
shows the debug mode. In the top left corner the simulation is handled. To let the simu-
lation run until a breakpoint is reached, press Run. In our example you'll see the GPOIB counting
up binary and the variable i in the Watch Window increasing. You can change the variables in the
Watch Window by double clicking on them. A breakpoint can be set by a double click on the left
area of the code window. A running simulation can be interrupted by pressing the stop icon.
Pressing reset will set the CPU to its initial State.
In case you want to step through your code it's not very nice to use breakpoints since these are
limited to 8. Therefore use the step commands. Step into will enter into every called function. Step
over doesn't enter the function. Step out lets the code in the function execute, leave the function
and wait for further commands. Run to cursor line lets the code run until the line is reached where
the cursor is.
Lukas Kohler
Listing 3.1: Minimal Code for a Counter on GPIOB
gpio . c / P r o j e c t gpio1
V1 . 0 0 / 1 5 . 0 7 . 2 0 0 9
ODR & 0 xFFFF0000 )
/
// STM32F10x L i b r a r y D e f i n i t i o n s
// STM32 I n i t i a l i z a t i o n
// c o u n t e r v a r i a b l e s
// STM32 setup
// Loop f o r e v e r
// i n c r e a s e f i r s t c o u n t e r
i ;
Start/Stop Debug Session or it's icon. This will
General Purpose I/O
2
The Electrocardiogram
// w r i t e i t o GPIOB
electrodes placed on the l
below.
GPIOB.
Josef Goette
Electrocardio
• Ecg: electrical ma
from the body surfa
• monitoring of heart
The Ecg signal can b
17
Need help?
Do you have a question about the STM32 Cortex-M3 and is the answer not in the manual?