portserial.txt
21.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\portserial.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\portserial.d --cpu=Cortex-M4.fp --apcs=interwork -O1 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I..\..\User\parameter -I..\..\User\LaserMotionCtr -I..\..\User\W5100S -I..\..\User\bsp -I..\..\User\CHASSIS -I..\..\User\CONTROLFUNCTION -I..\..\User\DATAUPDATE -I..\..\User\HARAWARE -I..\..\User\MOTORDRIVER -I..\..\User\NAVAGATION -I..\..\User\PLATFORM -I..\..\User\SENSOR -I.\RTE\_Flash -IC:\Users\YDJ\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\YDJ\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\portserial.crf ..\..\MODBUS\BARE\port\portserial.c]
THUMB
AREA ||i.USART2_IRQHandler||, CODE, READONLY, ALIGN=2
USART2_IRQHandler PROC
;;;257
;;;258 void USART2_IRQHandler(void)
000000 b570 PUSH {r4-r6,lr}
;;;259 {
;;;260 CPU_SR_ALLOC();
;;;261 CPU_CRITICAL_ENTER();
000002 f7fffffe BL CPU_SR_Save
000006 4604 MOV r4,r0
;;;262 OSIntEnter();
000008 f7fffffe BL OSIntEnter
;;;263 CPU_CRITICAL_EXIT();
00000c 4620 MOV r0,r4
00000e f7fffffe BL CPU_SR_Restore
;;;264
;;;265 if(USART_GetITStatus(USART2, USART_IT_RXNE) == SET)
000012 4c10 LDR r4,|L1.84|
000014 f2405525 MOV r5,#0x525
000018 4629 MOV r1,r5
00001a 4620 MOV r0,r4
00001c f7fffffe BL USART_GetITStatus
000020 2801 CMP r0,#1
000022 d105 BNE |L1.48|
;;;266 {
;;;267 prvvUARTRxISR();
000024 f7fffffe BL prvvUARTRxISR
;;;268 USART_ClearITPendingBit(USART2, USART_IT_RXNE);
000028 4629 MOV r1,r5
00002a 4620 MOV r0,r4
00002c f7fffffe BL USART_ClearITPendingBit
|L1.48|
;;;269 }
;;;270
;;;271 if(USART_GetITStatus(USART2, USART_IT_TXE) == SET)
000030 f2407527 MOV r5,#0x727
000034 4629 MOV r1,r5
000036 4620 MOV r0,r4
000038 f7fffffe BL USART_GetITStatus
00003c 2801 CMP r0,#1
00003e d105 BNE |L1.76|
;;;272 {
;;;273 prvvUARTTxReadyISR();
000040 f7fffffe BL prvvUARTTxReadyISR
;;;274 USART_ClearITPendingBit(USART2, USART_IT_TXE);
000044 4629 MOV r1,r5
000046 4620 MOV r0,r4
000048 f7fffffe BL USART_ClearITPendingBit
|L1.76|
;;;275 }
;;;276 OSIntExit();
00004c e8bd4070 POP {r4-r6,lr}
000050 f7ffbffe B.W OSIntExit
;;;277 }
;;;278
ENDP
|L1.84|
DCD 0x40004400
AREA ||i.prvvUARTRxISR||, CODE, READONLY, ALIGN=2
prvvUARTRxISR PROC
;;;249 */
;;;250 void prvvUARTRxISR( void )
000000 4801 LDR r0,|L2.8|
;;;251 {
;;;252 pxMBFrameCBByteReceived( );
000002 6800 LDR r0,[r0,#0] ; pxMBFrameCBByteReceived
000004 4700 BX r0
;;;253 }
;;;254
ENDP
000006 0000 DCW 0x0000
|L2.8|
DCD pxMBFrameCBByteReceived
AREA ||i.prvvUARTTxReadyISR||, CODE, READONLY, ALIGN=2
prvvUARTTxReadyISR PROC
;;;239 */
;;;240 void prvvUARTTxReadyISR( void )
000000 4801 LDR r0,|L3.8|
;;;241 {
;;;242 pxMBFrameCBTransmitterEmpty( );
000002 6800 LDR r0,[r0,#0] ; pxMBFrameCBTransmitterEmpty
000004 4700 BX r0
;;;243 }
;;;244
ENDP
000006 0000 DCW 0x0000
|L3.8|
DCD pxMBFrameCBTransmitterEmpty
AREA ||i.vMBPortSerialEnable||, CODE, READONLY, ALIGN=2
vMBPortSerialEnable PROC
;;;34 void
;;;35 vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable )
000000 b570 PUSH {r4-r6,lr}
;;;36 {
000002 460c MOV r4,r1
;;;37 /* If xRXEnable enable serial receive interrupts. If xTxENable enable
;;;38 * transmitter empty interrupts.
;;;39 */
;;;40 if(TRUE==xRxEnable)
;;;41 {
;;;42 //#ifdef USE_UART3_FOR_MONITOR
;;;43 USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
;;;44 GPIO_ResetBits(GPIOD,GPIO_Pin_4); //接收
000004 4d13 LDR r5,|L4.84|
000006 4e14 LDR r6,|L4.88|
000008 f2405125 MOV r1,#0x525 ;43
00000c 2801 CMP r0,#1 ;40
00000e d011 BEQ |L4.52|
;;;45 //#else
;;;46 // USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
;;;47 // GPIO_ResetBits(GPIOF, GPIO_Pin_5);
;;;48 //#endif
;;;49 }
;;;50 else
;;;51 {
;;;52 //#ifdef USE_UART3_FOR_MONITOR
;;;53 USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);
000010 2200 MOVS r2,#0
000012 4630 MOV r0,r6
000014 f7fffffe BL USART_ITConfig
;;;54 GPIO_SetBits(GPIOD,GPIO_Pin_4); //发送
000018 2110 MOVS r1,#0x10
00001a 4628 MOV r0,r5
00001c f7fffffe BL GPIO_SetBits
|L4.32|
;;;55 //#else
;;;56 // USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
;;;57 // GPIO_SetBits(GPIOF, GPIO_Pin_5);
;;;58 //#endif
;;;59
;;;60 }
;;;61
;;;62 if(TRUE==xTxEnable)
;;;63 {
;;;64 //#ifdef USE_UART3_FOR_MONITOR
;;;65 USART_ITConfig(USART2, USART_IT_TXE, ENABLE);
000020 f2407127 MOV r1,#0x727
000024 2c01 CMP r4,#1 ;62
000026 d00e BEQ |L4.70|
;;;66 //#else
;;;67 // USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
;;;68 //#endif
;;;69 }
;;;70 else
;;;71 {
;;;72 //#ifdef USE_UART3_FOR_MONITOR
;;;73 USART_ITConfig(USART2, USART_IT_TXE, DISABLE);
000028 4630 MOV r0,r6
00002a e8bd4070 POP {r4-r6,lr}
00002e 2200 MOVS r2,#0
000030 f7ffbffe B.W USART_ITConfig
|L4.52|
000034 2201 MOVS r2,#1 ;43
000036 4630 MOV r0,r6 ;43
000038 f7fffffe BL USART_ITConfig
00003c 2110 MOVS r1,#0x10 ;44
00003e 4628 MOV r0,r5 ;44
000040 f7fffffe BL GPIO_ResetBits
000044 e7ec B |L4.32|
|L4.70|
000046 4630 MOV r0,r6 ;65
000048 e8bd4070 POP {r4-r6,lr} ;65
00004c 2201 MOVS r2,#1 ;65
00004e f7ffbffe B.W USART_ITConfig
;;;74 //#else
;;;75 // USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
;;;76 //#endif
;;;77 }
;;;78 }
;;;79
ENDP
000052 0000 DCW 0x0000
|L4.84|
DCD 0x40020c00
|L4.88|
DCD 0x40004400
AREA ||i.xMBPortSerialGetByte||, CODE, READONLY, ALIGN=2
xMBPortSerialGetByte PROC
;;;220 BOOL
;;;221 xMBPortSerialGetByte( CHAR * pucByte )
000000 b510 PUSH {r4,lr}
;;;222 {
000002 4604 MOV r4,r0
;;;223 /* Return the byte in the UARTs receive buffer. This function is called
;;;224 * by the protocol stack after pxMBFrameCBByteReceived( ) has been called.
;;;225 */
;;;226 //#ifdef USE_UART3_FOR_MONITOR
;;;227 *pucByte =(unsigned char) USART_ReceiveData(USART2);
000004 4802 LDR r0,|L5.16|
000006 f7fffffe BL USART_ReceiveData
00000a 7020 STRB r0,[r4,#0]
;;;228 //#else
;;;229 // *pucByte =(unsigned char) USART_ReceiveData(USART1);
;;;230 //#endif
;;;231 return TRUE;
00000c 2001 MOVS r0,#1
;;;232 }
00000e bd10 POP {r4,pc}
;;;233
ENDP
|L5.16|
DCD 0x40004400
AREA ||i.xMBPortSerialInit||, CODE, READONLY, ALIGN=2
xMBPortSerialInit PROC
;;;82 BOOL
;;;83 xMBPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity )
000000 b5f0 PUSH {r4-r7,lr}
;;;84 {
000002 b087 SUB sp,sp,#0x1c
;;;85 GPIO_InitTypeDef GPIO_InitStructure;
;;;86 USART_InitTypeDef USART_InitStructure;
;;;87 NVIC_InitTypeDef NVIC_InitStructure;
;;;88
;;;89 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD,ENABLE); //使能GPIOF时钟
000004 2101 MOVS r1,#1
000006 2008 MOVS r0,#8
000008 f7fffffe BL RCC_AHB1PeriphClockCmd
;;;90
;;;91 GPIO_ResetBits(GPIOD, GPIO_Pin_4);//RS485方向选择 读
00000c 4f31 LDR r7,|L6.212|
00000e 2110 MOVS r1,#0x10
000010 4638 MOV r0,r7
000012 f7fffffe BL GPIO_ResetBits
;;;92 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
000016 2010 MOVS r0,#0x10
000018 9005 STR r0,[sp,#0x14]
;;;93 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
00001a 2501 MOVS r5,#1
00001c f88d5018 STRB r5,[sp,#0x18]
;;;94 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
000020 2400 MOVS r4,#0
000022 f88d401a STRB r4,[sp,#0x1a]
;;;95 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
000026 2003 MOVS r0,#3
000028 f88d0019 STRB r0,[sp,#0x19]
;;;96 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
00002c 2602 MOVS r6,#2
00002e f88d601b STRB r6,[sp,#0x1b]
;;;97 GPIO_Init(GPIOD, &GPIO_InitStructure);
000032 a905 ADD r1,sp,#0x14
000034 4638 MOV r0,r7
000036 f7fffffe BL GPIO_Init
;;;98
;;;99 RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);//使能USART3时钟
00003a 2101 MOVS r1,#1
00003c 0448 LSLS r0,r1,#17
00003e f7fffffe BL RCC_APB1PeriphClockCmd
;;;100
;;;101 //串口3对应引脚复用映射
;;;102 GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_USART2); //GPIOD8复用为USART3
000042 2207 MOVS r2,#7
000044 2105 MOVS r1,#5
000046 4638 MOV r0,r7
000048 f7fffffe BL GPIO_PinAFConfig
;;;103 GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_USART2); //GPIOD9复用为USART3
00004c 2207 MOVS r2,#7
00004e 2106 MOVS r1,#6
000050 4638 MOV r0,r7
000052 f7fffffe BL GPIO_PinAFConfig
;;;104
;;;105
;;;106 //USART3端口配置
;;;107 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6;
000056 2060 MOVS r0,#0x60
000058 9005 STR r0,[sp,#0x14]
;;;108 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
00005a f88d6018 STRB r6,[sp,#0x18]
;;;109 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
00005e f88d6019 STRB r6,[sp,#0x19]
;;;110 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
000062 f88d401a STRB r4,[sp,#0x1a]
;;;111 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
000066 f88d501b STRB r5,[sp,#0x1b]
;;;112 GPIO_Init(GPIOD,&GPIO_InitStructure);
00006a a905 ADD r1,sp,#0x14
00006c 4638 MOV r0,r7
00006e f7fffffe BL GPIO_Init
;;;113
;;;114
;;;115
;;;116 USART_InitStructure.USART_BaudRate = 115200;//波特率设置
000072 f44f30e1 MOV r0,#0x1c200
000076 9001 STR r0,[sp,#4]
;;;117
;;;118 USART_InitStructure.USART_WordLength = USART_WordLength_8b;//字长为9位数据格式
000078 f8ad4008 STRH r4,[sp,#8]
;;;119
;;;120 USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
00007c f8ad400a STRH r4,[sp,#0xa]
;;;121
;;;122 USART_InitStructure.USART_Parity = USART_Parity_No;//偶校验位
000080 f8ad400c STRH r4,[sp,#0xc]
;;;123
;;;124 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
000084 f8ad4010 STRH r4,[sp,#0x10]
;;;125 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
000088 200c MOVS r0,#0xc
00008a f8ad000e STRH r0,[sp,#0xe]
;;;126 USART_Init(USART2, &USART_InitStructure); //初始化串口3
00008e 4e12 LDR r6,|L6.216|
000090 a901 ADD r1,sp,#4
000092 4630 MOV r0,r6
000094 f7fffffe BL USART_Init
;;;127
;;;128 //Usart3 NVIC 配置
;;;129 NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;//串口3中断通道
000098 2126 MOVS r1,#0x26
00009a f88d1000 STRB r1,[sp,#0]
;;;130 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 10;//抢占优先级10
00009e 210a MOVS r1,#0xa
0000a0 f88d1001 STRB r1,[sp,#1]
;;;131 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
0000a4 f88d4002 STRB r4,[sp,#2]
;;;132 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
0000a8 f88d5003 STRB r5,[sp,#3]
;;;133 NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器?
0000ac 4668 MOV r0,sp
0000ae f7fffffe BL NVIC_Init
;;;134
;;;135 USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); //接收
0000b2 2201 MOVS r2,#1
0000b4 f2405125 MOV r1,#0x525
0000b8 4630 MOV r0,r6
0000ba f7fffffe BL USART_ITConfig
;;;136 USART_Cmd(USART2, ENABLE);
0000be 2101 MOVS r1,#1
0000c0 4630 MOV r0,r6
0000c2 f7fffffe BL USART_Cmd
;;;137
;;;138 USART_ClearFlag(USART2, USART_FLAG_TC);
0000c6 2140 MOVS r1,#0x40
0000c8 4630 MOV r0,r6
0000ca f7fffffe BL USART_ClearFlag
;;;139
;;;140 //#else
;;;141 //
;;;142 // RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE); //使能GPIOF时钟
;;;143 // GPIO_ResetBits(GPIOF, GPIO_Pin_5);//RS485方向选择
;;;144 // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
;;;145 // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
;;;146 // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
;;;147 // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
;;;148 // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
;;;149 // GPIO_Init(GPIOF, &GPIO_InitStructure);
;;;150 //
;;;151 // RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); //使能GPIOA时钟
;;;152 // RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);//使能USART1时钟
;;;153 //
;;;154 // //串口1对应引脚复用映射
;;;155 // GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); //GPIOA9复用为USART1
;;;156 // GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //GPIOA10复用为USART1
;;;157 //
;;;158 // //USART1端口配置
;;;159 // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10; //GPIOA9与GPIOA10
;;;160 // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用功能
;;;161 // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //速度50MHz
;;;162 // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //推挽复用输出
;;;163 // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
;;;164 // GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化PA9,PA10
;;;165
;;;166 // //Usart1 NVIC 配置
;;;167 // NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;//串口1中断通道
;;;168 // NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 10;//抢占优先级3
;;;169 // NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //子优先级3
;;;170 // NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ通道使能
;;;171 // NVIC_Init(&NVIC_InitStructure); //根据指定的参数初始化VIC寄存器、
;;;172 //
;;;173 // //USART1 初始化设置
;;;174 // USART_InitStructure.USART_BaudRate = 115200;//波特率设置
;;;175 // USART_InitStructure.USART_WordLength = USART_WordLength_9b;//字长为8位数据格式
;;;176 // USART_InitStructure.USART_StopBits = USART_StopBits_1;//一个停止位
;;;177 // USART_InitStructure.USART_Parity = USART_Parity_Even;//无奇偶校验位
;;;178 // USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;//无硬件数据流控制
;;;179 // USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //收发模式
;;;180 // USART_Init(USART1, &USART_InitStructure); //初始化串口1
;;;181 // USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); //接收
;;;182 // USART_Cmd(USART1, ENABLE);
;;;183
;;;184 // USART_ClearFlag(USART1, USART_FLAG_TC);
;;;185 //
;;;186 // USART_Cmd(USART1, ENABLE); //使能串口1
;;;187 ///* 485 引脚的初始化 */
;;;188 //#endif
;;;189 return TRUE;
;;;190 }
0000ce b007 ADD sp,sp,#0x1c
0000d0 2001 MOVS r0,#1 ;189
0000d2 bdf0 POP {r4-r7,pc}
;;;191 //发送一个字节
ENDP
|L6.212|
DCD 0x40020c00
|L6.216|
DCD 0x40004400
AREA ||i.xMBPortSerialPutByte||, CODE, READONLY, ALIGN=2
xMBPortSerialPutByte PROC
;;;192 BOOL
;;;193 xMBPortSerialPutByte( CHAR ucByte )
000000 b570 PUSH {r4-r6,lr}
;;;194 {
000002 4604 MOV r4,r0
;;;195 /* Put a byte in the UARTs transmit buffer. This function is called
;;;196 * by the protocol stack if pxMBFrameCBTransmitterEmpty( ) has been
;;;197 * called. */
;;;198 //#ifdef USE_UART3_FOR_MONITOR
;;;199 GPIO_SetBits(GPIOD, GPIO_Pin_4); //发送
000004 4d0a LDR r5,|L7.48|
000006 2110 MOVS r1,#0x10
000008 4628 MOV r0,r5
00000a f7fffffe BL GPIO_SetBits
;;;200
;;;201 USART_SendData(USART2, ucByte);
00000e 4621 MOV r1,r4
000010 4c08 LDR r4,|L7.52|
000012 4620 MOV r0,r4
000014 f7fffffe BL USART_SendData
|L7.24|
;;;202
;;;203 while(USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET)
000018 2140 MOVS r1,#0x40
00001a 4620 MOV r0,r4
00001c f7fffffe BL USART_GetFlagStatus
000020 2800 CMP r0,#0
000022 d0f9 BEQ |L7.24|
;;;204 {
;;;205 }
;;;206 GPIO_ResetBits(GPIOD, GPIO_Pin_4); //接收
000024 2110 MOVS r1,#0x10
000026 4628 MOV r0,r5
000028 f7fffffe BL GPIO_ResetBits
;;;207 //#else
;;;208 // GPIO_SetBits(GPIOF, GPIO_Pin_5);
;;;209 // USART_SendData(USART1, ucByte);
;;;210
;;;211 // while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
;;;212 // {
;;;213 // }
;;;214 // GPIO_ResetBits(GPIOF, GPIO_Pin_5);
;;;215 //#endif
;;;216 return TRUE;
00002c 2001 MOVS r0,#1
;;;217 }
00002e bd70 POP {r4-r6,pc}
;;;218 //接收一个字节
ENDP
|L7.48|
DCD 0x40020c00
|L7.52|
DCD 0x40004400
;*** Start embedded assembler ***
#line 1 "..\\..\\MODBUS\\BARE\\port\\portserial.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___12_portserial_c_2d663cdd____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___12_portserial_c_2d663cdd____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___12_portserial_c_2d663cdd____REVSH|
#line 144
|__asm___12_portserial_c_2d663cdd____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___12_portserial_c_2d663cdd____RRX|
#line 300
|__asm___12_portserial_c_2d663cdd____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***