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

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 15852|回復(fù): 4
收起左側(cè)

STM32玩arduino教程

[復(fù)制鏈接]
ID:249093 發(fā)表于 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, 下載次數(shù): 92)


回復(fù)

使用道具 舉報(bào)

ID:567765 發(fā)表于 2019-6-24 13:03 | 顯示全部樓層
you can try lingzhi platform, a STM32 arduino like board
回復(fù)

使用道具 舉報(bào)

ID:688008 發(fā)表于 2020-1-23 17:26 | 顯示全部樓層
這個(gè)boot適合103系列所有片子?
回復(fù)

使用道具 舉報(bào)

ID:72988 發(fā)表于 2020-4-3 14:44 | 顯示全部樓層
有stm32l0的嗎?
回復(fù)

使用道具 舉報(bào)

ID:295561 發(fā)表于 2020-4-3 16:09 | 顯示全部樓層
Thanks for your sharing
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 精品一区二区三区日本 | 欧洲性生活视频 | 美女久久久久久久 | 国产91网站在线观看 | 午夜免费网| 中文字幕在线国产 | 中文字幕二区 | 一区二区精品 | 精品中文在线 | 亚洲天堂久久 | 亚洲黄色av | 91在线精品一区二区 | 在线播放中文字幕 | 999久久久久久久久 国产欧美在线观看 | 永久精品| 久久影院一区 | 日韩一区二区三区四区五区六区 | 午夜精品久久久久99蜜 | 日韩久久综合网 | 99re在线播放 | 国产激情一区二区三区 | 成人黄视频在线观看 | 黑人性hd| 中文字幕人成乱码在线观看 | 久久一区二区三区四区 | 国产精品成人一区 | 四虎最新 | 免费看a | 国产精品不卡一区 | 精品免费 | www.色.com| 欧美自拍另类 | 久久久久九九九女人毛片 | 二区av| av性色全交蜜桃成熟时 | 国产原创在线观看 | 四虎永久免费影院 | 国产精品18毛片一区二区 | 91精品国产91久久久久久不卞 | 国产成人精品一区二区三区四区 | 婷婷午夜天|