IAR FOR STM8 Study Notes IAR Project Establishment

Publisher:浅唱清风Latest update time:2015-12-21 Source: eefocusKeywords:IAR  STM8 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
According to the requirements of the head of the lab, I bought STM8. For someone like me who has only used 51 to make something, STM8 is still a very advanced 8-bit machine. I personally feel that it is similar to AVR. Let's take a look at its features first!

 

STM8 is an 8-bit microcontroller developed by STMicroelectronics for industrial applications and consumer electronics.

Each MCU has its own advantages and disadvantages. Compared with other 8-bit MCUs, the biggest features of STM8 8-bit MCU are:

Kernel:

o Maximum fcpu frequency, up to 24MHz, 0 wait memory access when fcpu≤16MHz

o Advanced STM8 core, based on Harvard architecture with 3-stage pipeline

o Extended instruction set

o Up to 20 MIPS @ 24 MHz

Clock, reset and power management:

o 2.95V to 5.5V operating voltage

o Flexible clock control, 4 main clock sources

o Clock security system with clock monitoring

Power Management:

o Low power modes (wait, active stop, stop)

o Peripheral clocks can be shut down individually

o Always-on low-power power-on and power-down reset

· Communication Interface:

o High-speed 1Mbit/s CAN 2.0B interface

o UART with synchronous clock output — LIN Master Mode

o UART is compatible with LIN2.1 protocol, master/slave mode and automatic resynchronization

o SPI interface up to 10Mbit/s

I2C interface up to 400Kbit/s

I/O Ports:

o GPIO pins with high current sink output

o Very robust GPIO design, with strong tolerance to backflow current

Development Support:

o Single Wire Interface Module (SWIM) and Debug Module (DM) for easy in-circuit programming and non-intrusive debugging

Cost-effectiveness:

o Compared with many current 8-bit MCUs, the price-performance ratio of STM8 is relatively high.

There are so many advantages. Although I don’t understand many of them, I will learn them slowly. First, establish a development platform:

    I use IAR FOR STM8, which seems pretty good. The compiler is very efficient.

IAR download is also very simple, you can directly download the full version and the code-restricted version on the official website.


Start by creating a new project:

 

1. Create a workplace first. Select File>New>Workplace

2.(Create a new project, select Project>Create New Project. If you are using IAR FOR STM8, there is no need to change the default. Save and enter the Project name. The following is displayed in the workplace window

 

 

The default configuration is Debug

 3. Before adding files to the project, save the Workplace and enter the name of the saved file.

The extension of Workplace is eww.

4. Add files to the project, first File>New>File, or you can directly use the shortcut keys to create a new file. Then save it.

 

When saving, you can create a new C folder to distinguish other files in the project, making it easier to find and call them again.

Just add the files to the project and you can start.

Right click the project name > ADD > ADD FILES to add files.

First, add the header file and configure the registers for easy calling when writing the program.

Note: Remember to set the path so that IAR can find your header files.

Open the project Option settings, add your own path in C/++compiler --PreProcessor
such as
$PROJ_DIR$H // add the H subdirectory under the directory where the project file is located

 

test program:

#include

void main()

{

  while(1);

 }

Compile and connect:

 

Using ST-LINK, set it up before downloading

download

No errors, ready to go...

Keywords:IAR  STM8 Reference address:IAR FOR STM8 Study Notes IAR Project Establishment

Previous article:How to modify the STM8S library using IAR (I)
Next article:STM8L Study Notes - Unique Device ID (19)

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号