IAR+STM8——GPIO

Publisher:RadiantWhisperLatest update time:2016-11-09 Source: eefocusKeywords:IAR  STM8  GPIO Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
On the second day, we started learning from the most basic IO operations. Most of the IO on STM are GPIO.

When you are just starting to learn, don't make the test program complicated. The simpler it is, the less likely it is to make mistakes. The following is the code, without using the STM8 official firmware library.

//GPIO test

#include

#define LED1_FLASH PD_ODR_ODR3 = !PD_ODR_ODR3 // LED1 on the development board is connected to PD3

void delay(unsigned int count)
{
while(count--);
}

void GPIO_init(void)
{
PD_DDR = 0x08; // Configure the direction register PD3 output of the PD port
PD_CR1 = 0x08; // Set PD3 to push-pull output
}

void init_devices(void)
{
GPIO_init();
}

void main( void )
{
init_devices();
while(1)
{
delay(50000);
LED1_FLASH;
}
}

Keywords:IAR  STM8  GPIO Reference address:IAR+STM8——GPIO

Previous article:IAR+STM8——TIM1 timing overflow interrupt
Next article:Working principle and application of smart water meter based on MCU

Recommended ReadingLatest update time:2024-11-16 13:43

【STM8】SPI communication
: Introducing how to wire SPI, name explanation, and communication precautions : SPI pin locations relative to STM8, as well as pin settings, and some initialization code : Use registers to make some settings, such as baud rate, SPI on or off, SPI interrupt, transmission mode... There are too many to list, you need
[Microcontroller]
【STM8】SPI communication
STM8 Self-study Notes-002 Getting started with STM8 and establishing a development environment
Hardware Development Platform Debugger   Generally, it is difficult for beginners to write correct code in one go. Even experts will inevitably make some mistakes. Although the software development platform can point out syntactic errors during compilation, logical errors are difficult to point out. At this time, the
[Microcontroller]
STM8 Self-study Notes-002 Getting started with STM8 and establishing a development environment
Freescale IMX6 GPIO configuration method
When using imx6 gpio, you need to pay attention to the content in board-mx6q_sabresd.h This article uses MX6Q_PAD_CSI0_DAT10__UART1_RXD for detailed explanation: (1) Use source insight to view MX6Q_PAD_CSI0_DAT10__UART1_RXD #define MX6Q_PAD_CSI0_DAT11__UART1_RXD (_MX6Q_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL
[Microcontroller]
IAR generates HEX files
I have just started using IAR. The default file generated during compilation is .a90. However, when I download it directly using avr studio, it prompts that it is an informal HEX file and refuses to download it. I am very depressed.   It is actually very simple. Just add a few lines of text after the configuration fil
[Microcontroller]
IAR generates HEX files
IAR Systems fully supports Renesas RZ/T2 and RZ/N2 series MPUs
IAR Systems fully supports Renesas RZ/T2 and RZ/N2 series MPUs to facilitate real-time control and industrial network development Innovative tools from IAR Embedded Workbench® help accelerate development of next-generation factory automation applications that meet the real-time performance
[Embedded]
IAR Systems fully supports Renesas RZ/T2 and RZ/N2 series MPUs
In-depth analysis of the driver of the STM8 MCU GPIO port
In the previous section, we introduced the porting of the STM8 standard library. In this section, we will start to learn the peripheral drivers of our microcontroller. The basic peripheral information of the microcontroller includes GPIO, external interrupts, timers, serial ports, etc. This section will first introduc
[Microcontroller]
In-depth analysis of the driver of the STM8 MCU GPIO port
Connection error occurs when stm8 is downloaded using ST-Link
错误信息:Connection error (usb://usb): gdi-error : can't access configuration database Solution: Win7 solution: Reinstall Program Files (x86)/STMicroelectronics/st_toolset/stvd/dao/ST Toolset.msi and install it under administrator privileges Solution found on Baidu Knows: http://zhidao.baidu.com/link?url=_ft7AOwaWeKLK
[Microcontroller]
STM8 new IAR project
1. Prepare the standard library function file. The official standard library function is stsw-stm8069. After decompression, it is as shown below: 2. Create a new folder. In this example, name it stm8-project. Create four subfolders and name them APP, Readme, USER, and STM8S_StdPerph_Driver: 3. Copy files from the
[Microcontroller]
STM8 new IAR project
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号