久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 15763|回復: 4
打印 上一主題 下一主題
收起左側

STM32玩arduino教程

[復制鏈接]
跳轉到指定樓層
樓主
ID:249093 發表于 2018-11-28 17:07 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
1.introduction to stm32
The STM32 is a family of microcontroller ICs based on the 32-bit RISC ARM Cortex-M7F, Cortex-M4F, Cortex-M3, Cortex-M0+, and Cortex-M0 cores.[1]STMicroelectronics licenses the ARM Processor IP from ARM Holdings. The ARM core designs have numerous configurable options, and ST chooses the individual configuration to use for each design. ST attaches their own peripherals to the core before converting the design into a silicon die. The following tables summarize the STM32 microcontroller families.
[td]
Family: [xx][1][73]
Code
Core
Maxfreq[MHz]
Max FLASH [KB]
Max SRAM [KB]
Target
F0
CortexM0
48
256
32
Mainstream
F1
CortexM3
72
1024
96
Mainstream
F2
CortexM3
120
1024
128
High performance
F3
CortexM4
72
512
80
Mainstream
F4
CortexM4
180
2048
384
High performance
F7
CortexM7
216
2048
512
High performance
H7
CortexM7
400
2048
1024
High performance
L0
CortexM0+
32
192
20
Low power
L1
CortexM3
32
512
80
Low power
L4
CortexM4
80
1024
320
Low power


Pins for STM32F103 series





64 Pins
100Pins
144 Pins
2. How to run the IDE with STM32
Step 1: Getting ready(downloaded zip) .
Download package for STM32 at
http://github.com/rogerclarkmelbourne/Arduino_STM32
            Then open the directory for Arduino installing ,unzip the file into the interior
directory named hardware.
          Done all ,you’ll find STM32 series boards at the Arduino IDE:
tool-->board .
And choose the right one ,try to write your coding for compiling. If it works well ,greatly begin your coding . or else you may download another package using Arduino.




Step 2:Open Arduino,hit Tools ? Board:“board name”?Board Manager,install this file
Step 3: Turn to Arduino IDE , hit
Tools ? Board:“board name” ? Generic “STM32F103Z series”
Tools —> Variant —> STM32F103ZE
Tools —> upload method —> Serial (choose upload way)
Attention !!!
(On board :boot0 called BT0, boot1 called BT1, VCC called 3V3).
Before loading the boot0 connect VCC pin.
Reset each time you download again

    After loading the boot0 connect GND pin.
   Don’t care the boot1.
Then it all ok.
3. Introduction to Our board
Our board called STM32f10XZET6 , it has 144 pins
The pin’s number of analog is 21 , and with 18 channels .
STM32F103ZET6 PINS OF ANALOG
Channel
ADC1 IO
ADC2 IO
ADC3 IO
Channel0
PA0
PA0
PA0
Channel1
PA1
PA1
PA1
Channel2
PA2
PA2
PA2
Channel3
PA3
PA3
PA3
Channel4
PA4
PA4
PF6
Channel5
PA5
PA5
PF7
Channel6
PA6
PA6
PF8
Channel7
PA7
PA7
PF9
Channel8
PB0
PB0
PF10
Channel9
PB1
PB1
Interior VSS
Channel10
PC0
PC0
PC0
Channel11
PC1
PC1
PC1
Channel12
PC2
PC2
PC2
Channel13
PC3
PC3
PC3
Channel14
PC4
PC4
Interior VSS
Channel15
PC5
PC5
Interior VSS
Channel16
Interior temperature
Interior VSS
Interior VSS
Channel17
InteriorVrefint
Interior VSS
Interior VSS





The pin’s number of digital is 2, and with 2 output channels .
STM32F103ZET6 PINS OF DIGITAL
Channel1
PA4
Channel2
PA5


4.sample program
Step 1:Seekthe list about pins ,get your choice of pin for ADC. I get the PA3.
Step 2: Begin your coding.
         Here will list two ways to get the pot’s voltage by ADC.

       program 1:aim to : Using Analog pins to read the value of pot and output to the matched PWM.

int a, b;
void setup(){
                             pinMode(PA3,INPUT_ANALOG);
                             pinMode(PA6,OUTPUT);
                             Serial.begin(9600);
}
void loop(){
                             a=analogRead(PA3);
                             b=uint8(a*256/4096);
                             analogWrite(PA6,b);
                             Serial.println(a);
                             Serial.println(b);
                             delay(500);
                         }

program 2:aim to : Change the package’s example to get the ADC value achieve the same function as the first.
#include <STM32ADC.h>
STM32ADC myADC(ADC1);
uint8 pin = PA3;
volatile static bool triggered = 0;
uint32 dado_adc = 0,dado_out = 0;
void int_func() {
    triggered = 1;
    dado_adc = myADC.getData();
  dado_out=dado_adc*256/4096;
    analogWrite(PA6,dado_out);
  }
void setup() {
  Serial.begin(19200);
    pinMode(PA6,OUTPUT);
  pinMode(D32, INPUT);
    pinMode(PA3, INPUT_ANALOG);//AD pin.
  myADC.calibrate();
    myADC.setSampleRate(ADC_SMPR_1_5);
    myADC.attachInterrupt(int_func, ADC_EOC);
    myADC.setPins(&pin, 1);
}
void loop() {
      if(digitalRead(D32) == 1 ) {
      Serial.println("begin");     
      myADC.startConversion();
      while (triggered == 0); //wait here...
      delay(500);
      Serial.print("Readin: ");
      Serial.println(dado_adc);
      Serial.println(dado_out);      
      }
}

About the second one , I get the example of Github’s package.

There are six Arduino projects
Open the file called STM32ADC.c, I find the functions for coding . Using    these API we should make some change ,like the pins .We should find the pins than we choose named PA3 .Don’t care the D23 ,D33 and so on ,you can find the at boards.h ,sojust named the pins as usual cause computer knows those .The function you can also know from the notes .
To get the ADC knowledge you can seek them in internet . They will sure you better than me . You’d must know some key words ,like channel ,sample rate … and better to get how ADC work and working process.

完整的Word格式文檔51黑下載地址:
STN32ADC_Arduino_Bob.docx (3.35 MB, 下載次數: 92)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏2 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:567765 發表于 2019-6-24 13:03 | 只看該作者
you can try lingzhi platform, a STM32 arduino like board
回復

使用道具 舉報

板凳
ID:688008 發表于 2020-1-23 17:26 | 只看該作者
這個boot適合103系列所有片子?
回復

使用道具 舉報

地板
ID:72988 發表于 2020-4-3 14:44 | 只看該作者
有stm32l0的嗎?
回復

使用道具 舉報

5#
ID:295561 發表于 2020-4-3 16:09 | 只看該作者
Thanks for your sharing
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 中文字幕久久精品 | 欧美激情精品久久久久 | 全部免费毛片在线播放网站 | 精品日韩一区二区 | 日韩成人一区 | 欧美性猛交一区二区三区精品 | 特黄毛片| 亚洲人成人一区二区在线观看 | 久久久久国产一区二区三区不卡 | 欧美精品在线一区 | 粉嫩一区二区三区四区公司1 | 成人小视频在线免费观看 | 亚洲码欧美码一区二区三区 | 久久久www成人免费精品 | 亚洲国产精品人人爽夜夜爽 | 伊人精品在线 | av中文在线| 成人精品国产免费网站 | 久久99蜜桃综合影院免费观看 | 天天操天天玩 | 在线成人免费视频 | 91色在线视频 | 欧美黄色一级毛片 | 亚洲国产精品99久久久久久久久 | 91 在线 | 一区视频在线 | 男女在线网站 | 亚洲视频一区在线观看 | 天天干天天玩天天操 | 中文字幕一区二区三区在线观看 | 亚洲精品电影网在线观看 | 免费精品 | 国产精品欧美精品日韩精品 | 欧美精品一区二区三区在线播放 | 精品www| 欧美日本在线 | 久久网国产 | h视频在线观看免费 | 久草免费在线视频 | 国产成人av免费看 | 一级免费看 |