Salut à tous!
Voila j'ai un bout de code qui me pose un souci, je souhaiterais rajouter une condition à ma while afin d'eviter une boucle infini.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 void CommandParse(void) { unsigned int Addr; unsigned int Value; char c; c = UART1_Parse(); if(c) putchar(c); if(c!=0x0d) return; UartReadPtr = 0; UartRxPtr = 0; while ((UartRxCnt!=0) && (UartReadPtr <= UartRxCnt) ) { if (toupper(UartRxBuffer[UartReadPtr])=='W') { UartReadPtr++; SkipRaw(); Addr = GetHex(); SkipRaw(); Value = GetHex(); MAC_Write(Addr, Value); printf("\nOK\n"); } else if (toupper(UartRxBuffer[UartReadPtr])=='R') { UartReadPtr++; SkipRaw(); Addr = GetHex(); Value = MAC_Read(Addr); printf("\n%04x = %04x\n", Addr, Value); } else if (toupper(UartRxBuffer[UartReadPtr])=='T') { UartReadPtr++; SkipRaw(); CP220x_Send(&DESTMAC, UartRxBuffer, sizeof(UartRxBuffer) - UartRxPtr, IP_PACKET); printf("\nOK\n"); vBufferClear(); } else { printf("\nERROR\n"); } UartReadPtr++; } UartRxPtr = 0; }
Partager