ARM三級(jí)必過答案simon_第1頁
ARM三級(jí)必過答案simon_第2頁
ARM三級(jí)必過答案simon_第3頁
ARM三級(jí)必過答案simon_第4頁
ARM三級(jí)必過答案simon_第5頁
已閱讀5頁,還剩24頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、1.1-GPIO操作#define GPIO_Pin_3 (uint16_t)0x0008) #define GPIO_Pin_4 (uint16_t)0x0010) 這里要使用3,4腳,找到路徑,在#define GPIO_Pin_1 (uint16_t)0x0002) #define GPIO_Pin_2 (uint16_t)0x0004)下面添加3,4為1時(shí)就是0008和00101.1.2#define GPIO_Pin_7 (uint16_t)0x0080)#define GPIO_Pin_13 (uint16_t)0x2000)同上第7,13位為11.1.3 GPIO_InitStr

2、ucture.GPIO_Mode = GPIO_Mode_Out_PP ; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 實(shí)現(xiàn)GPIO在推挽模式和輸出最大速度為50MHz 1.1.4 STM_EVAL_LEDOn(LED1); Delay(0xAFFFF); STM_EVAL_LEDOn(LED2);Delay(0xAFFFF); STM_EVAL_LEDOn(LED3); Delay(0xAFFFF);STM_EVAL_LEDOn(LED4); Delay(0xAFFFF); 函數(shù)STM_EVAL_LEDOn(LED):實(shí)現(xiàn)LED點(diǎn)亮1.

3、1.5 STM_EVAL_LEDOn(LED1); Delay(0xAFFFF); STM_EVAL_LEDOn(LED2); Delay(0xAFFFF); STM_EVAL_LEDOn(LED3); Delay(0xAFFFF); STM_EVAL_LEDOn(LED4); Delay(0xAFFFF); /* Turn off */STM_EVAL_LEDOff(LED1);Delay(0xAFFFF);STM_EVAL_LEDOff(LED2);Delay(0xAFFFF);STM_EVAL_LEDOff(LED3);Delay(0xAFFFF);STM_EVAL_LEDOff(LED

4、4);Delay(0xAFFFF);函數(shù)STM_EVAL_LEDOn(LED):實(shí)現(xiàn)LED點(diǎn)亮函數(shù)STM_EVAL_LEDOff(LED):實(shí)現(xiàn)LED關(guān)閉1.1.6 STM_EVAL_LEDOff(LED3); Delay(0xAFFFF);STM_EVAL_LEDOff(LED4);函數(shù)STM_EVAL_LEDOff(LED):實(shí)現(xiàn)LED關(guān)閉為了看清加個(gè)延時(shí) 1.1.7STM_EVAL_LEDOff(LED2);STM_EVAL_LEDOff(LED4); 函數(shù)STM_EVAL_LEDOff(LED):實(shí)現(xiàn)LED關(guān)閉1.1.8STM_EVAL_LEDOn(LED3); Delay(0xAFF

5、FF); STM_EVAL_LEDOff(LED3);Delay(0xAFFFF); STM_EVAL_LEDOn(LED4);STM_EVAL_LEDOff(LED4);按要求點(diǎn)亮1.1.9STM_EVAL_LEDOn(LED1);Delay(0xAFFFF); STM_EVAL_LEDOff(LED1);STM_EVAL_LEDOn(LED3); Delay(0xAFFFF); STM_EVAL_LEDOff(LED3);按要求點(diǎn)亮 1.1.10 Delay(0xFFFFFF); STM_EVAL_LEDOn(LED1); Delay(0xFFFFFF); STM_EVAL_LEDOff(

6、LED1); STM_EVAL_LEDOn(LED3); STM_EVAL_LEDOff(LED3);按要求點(diǎn)亮1.2-中斷控制器使用方法 TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);直接copy下面的TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE); 1.2.2 NVIC_InitStructure.NVIC_IRQChannel = 28; /考試要求正確修改 Word中tim2是通道28,編譯有下面NVIC_IRQChannelPreemptionPriority轉(zhuǎn)到宏定義有個(gè)uint8_t NVIC_IRQChann

7、el;1.2.3 NVIC_InitStructure.NVIC_IRQChannel = 29; Word中tim3是通道29,編譯有下面NVIC_IRQChannelPreemptionPriority轉(zhuǎn)到宏定義有個(gè)uint8_t NVIC_IRQChannel;1.2.4 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelPreemption

8、Priority = 2;Word中NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority:優(yōu)先級(jí)配置1.2.5 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; Word中TIM2擁有搶占優(yōu)先級(jí)0,響應(yīng)優(yōu)先級(jí)0;TIM3擁有搶占優(yōu)先級(jí)1,響應(yīng)優(yōu)先級(jí)1;TIM4擁有搶占優(yōu)先級(jí)2,響應(yīng)優(yōu)先級(jí)0。 NVIC_InitStructure.NVIC_IRQChannelSubPriori

9、ty = 0; 1.2.6 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=2; NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;Word里面有兩大竄,使其擁有搶占優(yōu)先級(jí)2,響應(yīng)優(yōu)先級(jí)01.2.7NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;1.2.8/* Enable the USARTy_DMA1_IRQn Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = 16; 編譯進(jìn)入上面注解USAR

10、Ty_DMA1_IRQn可以看到使用16通道,前半部分下面有 1.2.9/* Toggle LED3 */ STM_EVAL_LEDToggle(LED3); Word有個(gè)函數(shù)STM_EVAL_LEDToggle(LEDx):LEDx狀態(tài)翻轉(zhuǎn)上面注解有l(wèi)ed3 1.2.10 /* Toggle LED32*/ STM_EVAL_LEDToggle(LED2); Word有個(gè)函數(shù)STM_EVAL_LEDToggle(LEDx):LEDx狀態(tài)翻轉(zhuǎn)上面注解有l(wèi)ed21.3-PWM脈沖寬度調(diào)制 printf("PWM Frequency 36KHzn"); word中已知TIMX3

11、CLK36MHz,分頻系數(shù)Prescaler=0,l TIM3的時(shí)鐘頻率: TIM3 counter clock=TIM3CLK/(Prescaler + 1)。l TIM3的頻率: Frequence=TIM3 counter clock/(TIM3_ARR+1)程序中tim3_arrshi 999,所以最后36khz 1.3.2 printf("PWM Frequency 18KHzn"); word中已知TIMX3CLK36MHz,分頻系數(shù)Prescaler=1,l TIM3的時(shí)鐘頻率: TIM3 counter clock=TIM3CLK/(Prescaler +

12、1)。l TIM3的頻率: Frequence=TIM3 counter clock/(TIM3_ARR+1)程序中tim3_arrshi 999,所以最后18khz1.3.3 printf("PWM Frequency 12KHzn"); word中已知TIMX3CLK36MHz,分頻系數(shù)Prescaler=2,l TIM3的時(shí)鐘頻率: TIM3 counter clock=TIM3CLK/(Prescaler + 1)。l TIM3的頻率: Frequence=TIM3 counter clock/(TIM3_ARR+1)程序中tim3_arrshi 999,所以最后1

13、2khz1.3.4 printf("PC.08:TIM3_CH3 25%n"); printf("PC.09:TIM3_CH4 12.5%n"); word1.3.5 printf("PC.06:TIM3_CH1 12.5%n"); printf("PC.07:TIM3_CH2 22.5%n"); printf("PC.08:TIM3_CH3 52.5%n"); printf("PC.09:TIM3_CH4 60%n"); 1.3.6/* Channel1 configura

14、tion */ TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable); TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable); /* Channel3 configuration */ TIM_SelectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable); TIM_

15、CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Enable); /* Channel2 configuration */ TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);step=1;就是copy上面5的通道3不變,1,2,對(duì)換,之后復(fù)位step=1;(213的順序兩行這里通道2兩行,3通道TIM_CCx后幾個(gè)都是Disable)1.3.7 /* Channel3 configuration */ TIM_Sel

16、ectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Enable); /* Channel1 configuration */ TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable); /* Channel2 configura

17、tion */ TIM_SelectOCxM(TIM1, TIM_Channel_2, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Enable); TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable); step+; 213的順序兩行這里通道1兩行,就是copy上面4的通道2不變,1,3,對(duì)換,之后step+;1.3.8 /* Channel3 configuration */ TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable)

18、; TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Disable); /* Channel1 configuration */ TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Enable); /* Channel2 configuration */ TIM_SelectOCxM(TIM1, TIM_Channel_

19、2, TIM_OCMode_PWM1); TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Enable); TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable); step+; 213的順序兩行這里通道3兩行,這里標(biāo)2,就是通道2,3對(duì)換1不變,之后step+;1.4-ADC模擬數(shù)字轉(zhuǎn)換器設(shè)計(jì)ADCx->CR1=(uint32_t)0x00000100;Word中ADC的工作方式為獨(dú)立模式位19到16為0一共32位即 (uint32_t)0x00000000) 使能掃描模式。位8為1就是0x000001001

20、.4.2ADC_InitStructure.ADC_Mode=ADC_Mode_Independent;在獨(dú)立模式下先編譯從下面ADC_ExternalTrigConv_None;轉(zhuǎn)到宏定義區(qū),上面找到獨(dú)立模式#define ADC_Mode_Independent (uint32_t)0x00000000)就ok1.4.3ADC_InitStructure.ADC_Mode=ADC_Mode_Independent; 獨(dú)立模式下轉(zhuǎn)一下就看到了ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; 連續(xù)執(zhí)行轉(zhuǎn)換是否使能就好ADC_InitStruc

21、ture.ADC_NbrOfChannel = 1; 且被轉(zhuǎn)換的ADC通道數(shù)為1。1.4.4ADC_InitStructure.ADC_Mode=ADC_Mode_Independent;ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;單次轉(zhuǎn)換ADC_InitStructure.ADC_NbrOfChannel = 1;1.4.5ADC_InitStructure.ADC_DataAlign=ADC_DataAlign_Right;ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; 連續(xù)轉(zhuǎn)換

22、從ADC_Mode_Independent;轉(zhuǎn)到宏定義區(qū)在下面找到對(duì)齊方式#define ADC_DataAlign_Right (uint32_t)0x00000000)1.4.6ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; 連續(xù)轉(zhuǎn)換ADC_InitStructure.ADC_DataAlign=ADC_DataAlign_Left;從ADC_Mode_Independent;轉(zhuǎn)到宏定義區(qū)在下面找到對(duì)齊方式#define ADC_DataAlign_Left (uint32_t)0x00000800)1.4.7printf("

23、ADC rusult: %3.2fVr",(float)(ADCConvertedValue)/0xfff*3.21);word中數(shù)據(jù)傳輸?shù)紸DC_ConvertedValue變量中就他1.4.8ADC_SoftwareStartConvCmd(ADC1, ENABLE);程序上面注解/* Start ADC1 Software Conversion */使能ADC1實(shí)現(xiàn)模數(shù)轉(zhuǎn)換1.4.9printf("ADCValue: %3.2fVr",(float)(ADCConvertedValue)/0xfff*3.21);ADC_ConvertedValue變量中 0

24、3.21V;ADC精度為12位1.4.10 ADC1,ADC_Channel_16 參數(shù)ADCx:ADC序號(hào)x參數(shù)ADC_Channel_x:ADC通道x1.5-DAC模擬數(shù)據(jù)轉(zhuǎn)換器設(shè)計(jì)DAC_InitStructure.DAC_WaveGeneration =DAC_WaveGeneration_Noise;不知道要填什么,進(jìn)入DAC_Trigger_Software,找到一個(gè)噪聲就ok1.5.2DAC_SetChannel1Data(DAC_Align_12b_L, 0x7FF0); word中數(shù)據(jù)為2047時(shí)轉(zhuǎn)換16進(jìn)制就是0x7ff0,后四位保留1.5.3DAC_InitStructu

25、re.DAC_WaveGeneration = DAC_WaveGeneration_Triangle;生成三角波編譯進(jìn)入DAC_Trigger_T2_TRGO;因?yàn)轭愋鸵粯佣x就在一起下面有個(gè)#define DAC_WaveGeneration_Triangle 就是三角波1.5.4DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude =(uint32_t)0x00000A80; 幅值為2047就是位11到位8為1010為A,位7到位6,使能三角波10為8,加起來就是A801.5.5 DMA_InitStructure.DMA_MemoryBa

26、seAddr = (uint32_t)&Escalator8bit;取寄存器地址前面有個(gè)const uint8_t Escalator8bit6= 0x0, 0x33,0x66,0x99,0xCC,0xFF;不懂1.5.6DAC_InitStructure.DAC_WaveGeneration =(uint32_t)0x00000000; 編譯,從DAC_Trigger_T6_TRGO;轉(zhuǎn)到定義上面有個(gè)#define DAC_Trigger_None (uint32_t)0x00000000)把后面的十六進(jìn)制填進(jìn)去就好,連續(xù)傳輸?shù)綌?shù)據(jù)移位寄存器1.5.71,DAC_InitStruct

27、ure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits11_0;word線性反饋移位寄存器LFSR長(zhǎng)度為12位編譯從下面DAC_Trigger_Software;轉(zhuǎn)到找設(shè)置位的,12位就是DAC_LFSRUnmask_Bits11_0;2,DAC_SetChannel1Data(DAC_Align_12b_L,0x5FF0);word里面DAC_SetChannel1Data(參數(shù)1, 參數(shù)2):設(shè)置通道1的數(shù)據(jù)寄存器函數(shù)一般為左對(duì)齊就是DAC_Align_12b_L,后一個(gè)參數(shù)就是0x5FF01.5.8DAC_InitStruct

28、ure.DAC_LFSRUnmask_TriangleAmplitude =DAC_TriangleAmplitude_2047;Word中產(chǎn)生2047幅度波,這里波幅就是2047,但不知道怎么寫就先編譯從下面的DAC_OutputBuffer_Disable;轉(zhuǎn)到宏定義區(qū)找到DAC_TriangleAmplitude_2047;1.5.9DAC_SetDualChannelData(DAC_Align_12b_R, 0x111, 0x111);Word 中DAC_SetDualChannelData(參數(shù)1,參數(shù)2,參數(shù)3):設(shè)置雙通道DAC數(shù)據(jù)函數(shù),后面兩個(gè)值有VREF*(DHRx / 4

29、095)= VREF/15算出dhrx=273化為十六進(jìn)制為0x111,還是直接記住比較好1.5.10DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits8_0;Word移位寄存器LFSR長(zhǎng)度為9位從下面DAC_Trigger_Software;轉(zhuǎn)到找宏定義區(qū),9位就是#define DAC_LFSRUnmask_Bits8_0 (uint32_t)0x00000800)2.1-SPI串行外設(shè)接口設(shè)計(jì)(溫濕度)SHT75_DAT_L;word中DATA翻轉(zhuǎn)為低電平上面就有SHT75_DAT_LSHT75

30、_CLK_L; SCK變?yōu)榈碗娖缴厦婢陀蠸HT75_CLK_Lsht11_Delay();SHT75_CLK_H;隨后是在SCK時(shí)鐘高電平時(shí)DATA翻轉(zhuǎn)為高電平2.1.2SHT75_DAT_L; DATA翻轉(zhuǎn)為低電平SHT75_DAT_H; DATA翻轉(zhuǎn)為高電平word中有2.1.3SHT75_DAT_H;SCK變?yōu)榈碗娖?,隨后是在SCK時(shí)鐘高電平時(shí)DATA翻轉(zhuǎn)為高電平SHT75_CLK_H; SCK時(shí)鐘高電平時(shí)DATA翻轉(zhuǎn)為低電平2.1.4SHT75_DAT_H; word當(dāng)SCK時(shí)鐘高電平時(shí)DATA翻轉(zhuǎn)為低電平相反就是高SHT75_CLK_L; 要想翻轉(zhuǎn),下面有個(gè)clkH那這里就必須是_C

31、LK_L;2.1.5 temp_val|= tmp_byte; 就是把上面CACU_CRC = Table(CACU_CRCtmp_byte); tmp_byte給這個(gè)變量2.1.6 temp_val |= tmp_byte<<8; temp_val是16位,存放兩個(gè)8位,先放高8位2.1.7 *t= temp_val; 定義了一個(gè)指針取已經(jīng)采集到的溫度2.1.8 hum_val |= tmp_byte<<8; 程序下面有tmp_byte = s_Read_SHT11_Byte(); /讀取高8位 CACU_CRC = Table(CACU_CRCtmp_byte);

32、/進(jìn)行第二次CRC temp_val |= tmp_byte<<8;意思把高8位給hum_val2.1.9 hum_val |= tmp_byte; 程序下面有 tmp_byte = s_Read_SHT11_Byte(); /讀取低8位 CACU_CRC = Table(CACU_CRCtmp_byte); /進(jìn)行第三次CRC temp_val |= tmp_byte;2.1.10 *h =hum_val; 上面有個(gè)tmp_byte = s_Read_SHT11_Byte(); CACU_CRC = Table(CACU_CRCtmp_byte); /進(jìn)行第三次CRC hum_v

33、al |= tmp_byte; 完成第三次校驗(yàn)就是最終值給指針2.2內(nèi)部集成電路IIC接口設(shè)計(jì)(光照度)#define EEPROM_WriteAddress1 0x88 word中有 #define EEPROM_ReadAddress1 0x88uint8_t Tx1_Buffer = "ASTM32F10x I2C Firmware "第一個(gè)字母必需是大寫A,后面有個(gè)函數(shù)會(huì)都這個(gè)數(shù)組的第一個(gè)字母就是A了,后面是什么無所謂不會(huì)都到2.2.2#define EEPROM_WriteAddress1 0x99 #define EEPROM_ReadAddress1 0x99

34、uint8_t Tx1_Buffer = "BASTM32F10x I2C Firmware "第一個(gè)字母必需是大寫B(tài),后面有個(gè)函數(shù)會(huì)都這個(gè)數(shù)組的第一個(gè)字母就是A了,后面是什么無所謂不會(huì)都到2.2.3#define EEPROM_HW_ADDRESS 0xA0 WORD中E0,E1 and E2三個(gè)引腳都接地,所以物理地址空間為0XA0printf("EEPROM PHY ADDRESS:0xA0");2.2.4/* Write on I2C EEPROM from EEPROM_WriteAddress1 */ * Read from I2C EEPR

35、OM from EEPROM_ReadAddress1 */ I2C_EE_BufferRead(Rx1_Buffer, EEPROM_ReadAddress1, BufferSize1); I2C_EE_BufferWrite(Tx1_Buffer, EEPROM_WriteAddress1, BufferSize1); 上面注釋講實(shí)現(xiàn)Tx1_Buffer寫操作,copy都操作I2C_EE_BufferWrite(Tx2_Buffer,EEPROM_WriteAddress2,BufferSize2); 實(shí)現(xiàn)Tx2_Buffer寫操作2.2.5I2C_EE_BufferWrite(Tx1_B

36、uffer, EEPROM_WriteAddress1, BufferSize1); /* Read from I2C EEPROM from EEPROM_ReadAddress1 */ /考試要求1: I2C_EE_BufferRead(Rx1_Buffer, EEPROM_ReadAddress1, BufferSize1);實(shí)現(xiàn)從EEPROM讀數(shù)據(jù),地址為EEPROM_ReadAddress1,字節(jié)數(shù)為BufferSize1,賦給變量 Rx1_BufferI2C_EE_BufferRead(Rx2_Buffer, EEPROM_ReadAddress2, BufferSize2); 2

37、.2.6 I2C_EE_BufferWrite(Tx1_Buffer, EEPROM_WriteAddress1, BufferSize1); 什么題不解釋 I2C_EE_BufferRead(Rx2_Buffer, EEPROM_ReadAddress2, BufferSize2);2.2.7Lux=CalculateLux(GainSetHigh>>4, IntegScal1000, LightIntensity0, LightIntensity1, T); 程序下面直接copy過來2.2.8Word中正確實(shí)現(xiàn)SlaveAddressVDD的地址映射#defineSlaveAd

38、dressVDD0x49模仿下面的,word中1001001就是ox492.2.9有個(gè)路徑:Address.h。找不到在左側(cè)light文件右擊添加文檔,加進(jìn)來就ok #defineSlaveAddressVDD0x49 Lux=CalculateLux(GainSetHigh>>4, IntegScal1000, LightIntensity0, LightIntensity1, T);下面有一模一樣的2.2.10#defineSlaveAddressVDD0x49 Lux=CalculateLux(GainSetHigh>>4, IntegScal1000, Ligh

39、tIntensity0, LightIntensity1, T);程序錯(cuò)誤代碼全亂了,就是不對(duì),考試不會(huì) 2.3-通用同步異步收發(fā)機(jī)USART設(shè)計(jì) 115200; USART_Parity_No; PUTCHAR_PROTOTYPE Word中波特率115200,無校驗(yàn),調(diào)用這個(gè)函數(shù)(沒有括號(hào))復(fù)位超級(jí)終端設(shè)置好會(huì)顯示USART Printf Example: retarget the C library printf function to the USARTUSART Printf Example: hello kitty 2.3.2 9600; USART_Parity_No; PUTC

40、HAR_PROTOTYPE Word中波特率9600,無校驗(yàn),調(diào)用這個(gè)函數(shù)(沒有括號(hào))復(fù)位超級(jí)終端設(shè)置好會(huì)顯示USART Printf Example: retarget the C library printf function to the USARTUSART Printf Example: hello kitty 2.3.3 57600 USART_Parity_No; PUTCHAR_PROTOTYPE Word中波特率9600,無校驗(yàn),調(diào)用這個(gè)函數(shù)(沒有括號(hào))復(fù)位超級(jí)終端設(shè)置好會(huì)顯示USART Printf Example: retarget the C library print

41、f function to the USARTUSART Printf Example: hello kitty 2.3.4USART_InitStructure.USART_BaudRate = 115200; RxBufferRxCounter = (USART_ReceiveData(EVAL_COM1) & 0x7F); 是為了計(jì)數(shù)在下面函數(shù)中printf("%c",RxBufferRxCounter+);#define RxBufferSize 0xA 要求10個(gè)字符轉(zhuǎn)換成十六進(jìn)制為A 通信成功在電腦上輸入十個(gè)鍵值在lcd上面顯示出來2.3.5 USART

42、_InitStructure.USART_Parity = USART_Parity_Odd; 奇校驗(yàn) if(RxCounter = NbrOfDataToRead) 判斷用= #define RxBufferSize 0x14 輸入20十個(gè)鍵值十六進(jìn)制為14通信成功在電腦上輸入20個(gè)鍵值在lcd上面顯示出來2.3.6USART_InitStructure.USART_BaudRate = 115200; printf("%c",RxBufferRxCounter+); 加一輸出下一個(gè)鍵值#define RxBufferSize 0xf 要求十五個(gè)鍵值 2.3.7USART

43、_InitStructure.USART_BaudRate = 115200; /考試要求2,添加一行,用printf語句實(shí)現(xiàn)版本號(hào)顯示 printf("VER:%8.0xn", version);word中vs8 EM380C_Get_ver(u32* version) 函數(shù)功能:用于獲得EM380C的固件版本號(hào),8位 ret = send_cmd(EMSP_CMD_GET_VER, 0, NULL, 0); ver前后呼應(yīng),和上面輸出的一樣2.3.8USART_InitStructure.USART_BaudRate = 115200;USART_InitStructu

44、re.USART_Parity =USART_Parity_No ;ret = send_cmd(EMSP_CMD_GET_VER, 0, NULL, 0); main.c中有 printf("VER:%8.0xn",version);所以要使用ver2.3.9 USART_InitStructure.USART_BaudRate = 115200; ret = send_cmd(EMSP_CMD_SCAN_AP, 0, NULL, 0);發(fā)送獲取AP命令printf("%s", APlist_tmp->AP_NAME); 正確輸出AP的SSID

45、號(hào)而不是信號(hào) 2.3.10 printf("VER:%8.0xn",version); 同上 printf("%s", APlist_tmp->AP_NAME);輸出獲得AP的SSID號(hào) free(EM380C_APLst_now);free是c語言中的是釋放空間函數(shù),注解里有2.4-Ethernet以太網(wǎng)設(shè)計(jì)char const *hosts1 = "WWW" ;格式?jīng)]有什么逗號(hào) IP1 192 IP2 168 IP3 0IP4 120WORD 2.4.2 char const *hosts1 = “”; IP1 192 IP

46、2 168 IP3 0IP4 100WORD2.4.3 IP1 192 IP2 168 IP3 0 IP4 90 WORD2.4.4 IP1 192 IP2 168 IP3 0 IP4 78WORD2.4.5#define MCR_LM 0x00001000 #define MCR_DM 0x00000800 #define MCR_IPCO 0x00000400 Word文檔中為1,第十二位1000,第一個(gè)是零位2.4.6#define MCR_TE 0x00000008 #define MCR_RE 0x00000004 Word文檔中為1 2.4.7#define MCR_RE 0x00

47、000004 Word文檔中為1 添加ETH_STM32x.h文件我自己的 添加文檔tcp_cm3.lib2.4.8路徑不對(duì),應(yīng)該是 TCPnet_examplesLibrary Net_Config.c#define HTTP_AUTHPASSW "111111" 在這里添加密碼來自word2.4.9路徑不對(duì),應(yīng)該是TCPnet_examplesLibrary Net_Config.c#define HTTP_AUTHPASSW "111222” 在這里添加密碼來自word2.4.10路徑不對(duì),應(yīng)該是TCPnet_examplesLibrary Net_Conf

48、ig.c#define HTTP_AUTHPASSW "222222" 在這里添加密碼來自word3.1-人機(jī)交互應(yīng)用case JOY_LEFT: 重要提示 px_o=px;px-=1; if(px<0) px=3; case JOY_RIGHT: 重要提示 px_o=px;px+=1;if(px>3) px=0; 上下對(duì)調(diào)3.1.2 case JOY_UP: 重要提示 py_o=py;py-=1;if(py<0) py=3; case JOY_DOWN: 重要提示 py_o=py;py+=1;if(py>3) py=0; 上下對(duì)調(diào)3.1.3case

49、 JOY_UP: py_o=py;px_o=px;if(py) py=0; else py=1; case JOY_DOWN: py_o=py;px_o=px;if(py) py=0; else py=1; case JOY_LEFT: py_o=py;px_o=px;if(px) px=0; else px=1; case JOY_RIGHT: py_o=py;px_o=px;if(px) px=0; else px=1;上下為y,左右為x 3.1.4 /* Toggle LD1 */STM_EVAL_LEDToggle(LED1);把led4改為led1 3.1.5 if (TS_Stat

50、e->Y > 180) && (TS_State->Y < 220)&&(TS_State->X < 70) && (TS_State->X > 10) else if(TS_State->Y > 180) && (TS_State->Y < 220)&&(TS_State->X < 150) && (TS_State->X > 90) else if(TS_State->Y > 180) &

51、amp;& (TS_State->Y < 220)&&(TS_State->X < 230) && (TS_State->X > 170) else if(TS_State->Y > 180) && (TS_State->Y < 220)&&(TS_State->X < 310) && (TS_State->X > 250) if (TS_State->Y > 180) && (TS_State-

52、>Y < 220)&&(TS_State->X < 310) && (TS_State->X > 250) else if(TS_State->Y > 180) && (TS_State->Y < 220)&&(TS_State->X < 230) && (TS_State->X > 170) else if(TS_State->Y > 180) && (TS_State->Y < 220)&

53、amp;&(TS_State->X < 150) && (TS_State->X > 90) else if(TS_State->Y > 180) && (TS_State->Y < 220)&&(TS_State->X < 70) && (TS_State->X > 10) 前一半一樣后面一半大對(duì)調(diào),反過來 3.1.6if (TS_State->Y > 205) && (TS_State->Y < 230)&a

54、mp;&(TS_State->X < 60) && (TS_State->X > 20) else if(TS_State->Y > 165) && (TS_State->Y < 190)&&(TS_State->X < 60) && (TS_State->X > 20) else if(TS_State->Y > 125) && (TS_State->Y < 150)&&(TS_State-&g

55、t;X < 60) && (TS_State->X > 20) else if(TS_State->Y > 85) && (TS_State->Y < 110)&&(TS_State->X < 60) && (TS_State->X > 20) if (TS_State->Y > 85) && (TS_State->Y < 110)&&(TS_State->X < 60) && (TS_State->X &

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論