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

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

QQ登錄

只需一步,快速開始

搜索
查看: 15886|回復(fù): 4
打印 上一主題 下一主題
收起左側(cè)

STM32玩arduino教程

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:249093 發(fā)表于 2018-11-28 17:07 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
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)


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

使用道具 舉報(bào)

沙發(fā)
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)

5#
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ù) 返回頂部 返回列表
主站蜘蛛池模板: 亚洲精选在线观看 | 黄色大片av| 久久久久国产精品夜夜夜夜夜 | 亚洲一区二区免费看 | 蜜臀久久99精品久久久久久宅男 | 欧美91视频 | 国产一级特黄 | 精品在线免费视频 | 国产精自产拍久久久久久蜜 | 午夜欧美 | 亚洲天堂国产 | 成人三级小说 | 国产精品久久一区二区三区 | 精品一区二区三区视频 | 欧洲一级毛片 | 成人国产在线 | 黄色草逼视频 | 亚洲国产精品久久 | 成人在线视频网 | 国产精品一区二区三区四区五区 | 免费av不卡 | 国产精品欧美一区二区 | 日韩精品一二区 | 日韩视频在线观看 | 久久av影院 | 亚洲黄色av| 黄色一极片 | 一区二区三区视频在线 | 操日本老女人 | 国产精品尤物 | 欧美黄色一级大片 | 国产一区二区免费看 | 黄色a网站 | 一级特黄aaaaaa大片 | 亚洲欧美成人 | 天天射av| 成人av一区二区三区在线观看 | 国产日韩欧美日韩大片 | 日韩免费在线观看 | 午夜黄色小视频 | 久久精品一区二区三区不卡牛牛 |