日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁(yè) > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]STM32F10X.H1 #include "core_cm3.h"2 #include "system_stm32f10x.h"3 #include 45 /** @addtogroup Exported_types6 * @{7 */ 89 /*!< STM32F10x Standard Peripheral Library old types (maintained for legacy

STM32F10X.H



1 #include "core_cm3.h"

2 #include "system_stm32f10x.h"

3 #include

4

5 /** @addtogroup Exported_types

6 * @{

7 */

8

9 /*!< STM32F10x Standard Peripheral Library old types (maintained for legacy purpose) */

10 typedef int32_t s32;

11 typedef int16_t s16;

12 typedef int8_t s8;

13

14 typedef const int32_t sc32; /*!< Read Only */

15 typedef const int16_t sc16; /*!< Read Only */

16 typedef const int8_t sc8; /*!< Read Only */

17

18 typedef __IO int32_t vs32;

19 typedef __IO int16_t vs16;

20 typedef __IO int8_t vs8;

21

22 typedef __I int32_t vsc32; /*!< Read Only */

23 typedef __I int16_t vsc16; /*!< Read Only */

24 typedef __I int8_t vsc8; /*!< Read Only */

25

26 typedef uint32_t u32;

27 typedef uint16_t u16;

28 typedef uint8_t u8;

29

30 typedef const uint32_t uc32; /*!< Read Only */

31 typedef const uint16_t uc16; /*!< Read Only */

32 typedef const uint8_t uc8; /*!< Read Only */

33

34 typedef __IO uint32_t vu32;

35 typedef __IO uint16_t vu16;

36 typedef __IO uint8_t vu8;

37

38 typedef __I uint32_t vuc32; /*!< Read Only */

39 typedef __I uint16_t vuc16; /*!< Read Only */

40 typedef __I uint8_t vuc8; /*!< Read Only */

41

42 typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;

43

44 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;

45 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))

46

47 typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;


源定義在#include


1 /*

2 * 'signed' is redundant below, except for 'signed char' and if

3 * the typedef is used to declare a bitfield.

4 */

5

6 /* 7.18.1.1 */

7

8 /* exact-width signed integer types */

9 typedef signed char int8_t;

10 typedef signed short int int16_t;

11 typedef signed int int32_t;

12 typedef signed __INT64 int64_t;

13

14 /* exact-width unsigned integer types */

15 typedef unsigned char uint8_t;

16 typedef unsigned short int uint16_t;

17 typedef unsigned int uint32_t;

18 typedef unsigned __INT64 uint64_t;

19

20 /* 7.18.1.2 */

21

22 /* smallest type of at least n bits */

23 /* minimum-width signed integer types */

24 typedef signed char int_least8_t;

25 typedef signed short int int_least16_t;

26 typedef signed int int_least32_t;

27 typedef signed __INT64 int_least64_t;

28

29 /* minimum-width unsigned integer types */

30 typedef unsigned char uint_least8_t;

31 typedef unsigned short int uint_least16_t;

32 typedef unsigned int uint_least32_t;

33 typedef unsigned __INT64 uint_least64_t;

34

35 /* 7.18.1.3 */

36

37 /* fastest minimum-width signed integer types */

38 typedef signed int int_fast8_t;

39 typedef signed int int_fast16_t;

40 typedef signed int int_fast32_t;

41 typedef signed __INT64 int_fast64_t;

42

43 /* fastest minimum-width unsigned integer types */

44 typedef unsigned int uint_fast8_t;

45 typedef unsigned int uint_fast16_t;

46 typedef unsigned int uint_fast32_t;

47 typedef unsigned __INT64 uint_fast64_t;

48

49 /* 7.18.1.4 integer types capable of holding object pointers */

50 #if __sizeof_ptr == 8

51 typedef signed __INT64 intptr_t;

52 typedef unsigned __INT64 uintptr_t;

53 #else

54 typedef signed int intptr_t;

55 typedef unsigned int uintptr_t;

56 #endif

57

58 /* 7.18.1.5 greatest-width integer types */

59 typedef signed __LONGLONG intmax_t;

60 typedef unsigned __LONGLONG uintmax_t;


由上述可知:


1、有符號(hào)整型

s8 占用1個(gè)byte,數(shù)據(jù)范圍 -2^7 到 (2^7-1)

s16 占用2個(gè)byte,數(shù)據(jù)范圍 -2^15 到 (2^15-1)

s32 占用 4個(gè)byte,數(shù)據(jù)范圍 -2^31 到 (2^31-1)2^31 =2147483647

int64_t占用8個(gè)byte,數(shù)據(jù)范圍 -2^63 到 (2^63-1) 2^63 =9223372036854775807ll

2、無(wú)符號(hào)整型

u8 占用1個(gè)byte, 數(shù)據(jù)范圍 0 - 2^8

u16 占用2個(gè)byte, 數(shù)據(jù)范圍 0 - 2^16

u32 占用4個(gè)byte, 數(shù)據(jù)范圍 0 - 2^32 2^32 =4294967295

uint64_t 占用8個(gè)byte, 數(shù)據(jù)范圍 0 - 2^64 2^64 =18446744073709551615

3、浮點(diǎn)型

float ——4個(gè)byte,有符號(hào)型,可以表達(dá)負(fù)數(shù)/小數(shù);Float 類型至少要能精確表示到小數(shù)點(diǎn)后6位。

double——8個(gè)byte,有符號(hào)型,可以表達(dá)負(fù)數(shù)/小數(shù);Double 類型至少要能精確到小數(shù)點(diǎn)后 10 位。

二、不同數(shù)據(jù)類型混合運(yùn)算

在C語(yǔ)言中,不同類型的數(shù)據(jù)間是可以混合運(yùn)算的。在進(jìn)行運(yùn)算時(shí),不同類型的數(shù)據(jù)要先轉(zhuǎn)換成同一類型,然后進(jìn)行運(yùn)算。轉(zhuǎn)換的規(guī)則如下:

注意:箭頭的方向只表示數(shù)據(jù)類型級(jí)別的高低,由低向高轉(zhuǎn)換,這個(gè)轉(zhuǎn)換過(guò)程是一步到位的。

(三)數(shù)據(jù)類型轉(zhuǎn)換規(guī)則

各類數(shù)據(jù)類型的轉(zhuǎn)換,分為兩種方式:隱式(編譯軟件自動(dòng)完成),顯式(程序強(qiáng)制轉(zhuǎn)換)

隱式轉(zhuǎn)換規(guī)則:

字符必須先轉(zhuǎn)換為整數(shù)(C語(yǔ)言規(guī)定字符類型數(shù)據(jù)和整型數(shù)據(jù)之間可以通用)
short型轉(zhuǎn)換為int型(同屬于整型)
float型數(shù)據(jù)在運(yùn)算時(shí)一律轉(zhuǎn)換為雙精度(double)型,以提高運(yùn)算精度(同屬于實(shí)型)
賦值時(shí),一律是右部值轉(zhuǎn)換為左部類型
[注]
當(dāng)整型數(shù)據(jù)和雙精度數(shù)據(jù)進(jìn)行運(yùn)算時(shí),C先將整型數(shù)據(jù)轉(zhuǎn)換成雙精度型數(shù)據(jù),再進(jìn)行運(yùn)算,結(jié)果為雙精度類型數(shù)據(jù)
當(dāng)字符型數(shù)據(jù)和實(shí)型數(shù)據(jù)進(jìn)行運(yùn)算時(shí),C先將字符型數(shù)據(jù)轉(zhuǎn)換成實(shí)型數(shù)據(jù),然后進(jìn)行計(jì)算,結(jié)果為實(shí)型數(shù)據(jù)

顯式轉(zhuǎn)換規(guī)則:

例:(int)(x+y);

注:強(qiáng)制類型轉(zhuǎn)換時(shí),得到一個(gè)所需要的中間變量,原來(lái)變量的類型未發(fā)生變化。


本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉