Hilfe, ich finde den Fehler einfach nicht Ferhlermeldung beim Compelieren im Keil uVesion main.c(37): error: #167: argument of type "COM_TYP *" is incompatible with parameter of type "unsigned long" main.c(37): error: #165: too few arguments in function call main()
1  | uart0_init(&com_var_1);  | 
C-File
1  | typedef struct  | 
2  | {
 | 
3  | unsigned long baudrate;  | 
4  | unsigned char dataBits;  | 
5  | unsigned char stopBits;  | 
6  | unsigned char parity;  | 
7  | } COM_TYP;  | 
8  | |
9  | extern COM_TYP com_var;  | 
1  | set_com_data(COM_TYP *pcd_data)  | 
2  | {
 | 
3  | pcd_data->baudrate = 9600;  | 
4  | pcd_data->dataBits = 8;  | 
5  | pcd_data->stopBits = 1;  | 
6  | pcd_data->parity = 0;  | 
7  | }
 | 
C-File
1  | /*UART0 Initialization*/ 
 | 
2  | int uart0_init( unsigned long int baudrate, unsigned char dataBits, unsigned char stopBits, unsigned char parity )  | 
3  | { 
 | 
4  | unsigned char ucTemp;  | 
5  | |
6  | ucTemp = 0;  | 
7  |   // Word Lenght Select
 | 
8  | if (dataBits == 7)  | 
9  | ucTemp |= 0x02;  | 
10  | else if (dataBits == 8)  | 
11  | ucTemp |= 0x03;  | 
12  |   else
 | 
13  | return(ERR_COM_INIT_LINE_SETTINGS);  | 
14  | |
15  |   // Stop Bit Select
 | 
16  | if (stopBits == 1 )  | 
17  | ucTemp |= 0x00;  | 
18  | else if ( stopBits == 2 )  | 
19  | ucTemp |= 0x04;  | 
20  |   else
 | 
21  | return(ERR_COM_INIT_LINE_SETTINGS);  | 
22  | |
23  |   // Parity Enable
 | 
24  | if (parity == 0) //disable  | 
25  | ucTemp |= 0x00;  | 
26  | else if (parity == 1) //enable  | 
27  | ucTemp |= 0x04;  | 
28  |   else
 | 
29  | return(ERR_COM_INIT_LINE_SETTINGS);  | 
30  | |
31  |   //Parity Select
 | 
32  | if (parity == 'o')  | 
33  | ucTemp |= 0x00;  | 
34  | else if (parity == 'e')  | 
35  | ucTemp |= 0x10;  | 
36  | else if (parity == 1)  | 
37  | ucTemp |= 0x20;  | 
38  | else if (parity == 0)  | 
39  | ucTemp |= 0x30;  | 
40  |   else
 | 
41  | return(ERR_COM_INIT_LINE_SETTINGS);  | 
42  | |
43  |   // Devisor Latch Access Bit(DLAB) enable
 | 
44  | ucTemp |= 0x80;  | 
45  | U0LCR = ucTemp; /*8 bits, 1 stopbit, no Parity, enable DLAB*/  | 
46  | |
47  |   // Baudrate Select  
 | 
48  | switch ( baudrate )  | 
49  |   {
 | 
50  | case 4800:  | 
51  | U0DLM = 0x02; /*4800 Baud Rate, 55.296.000 PCLK*/  | 
52  | U0DLL = 0xD0; /*720dez=0x02Do*/  | 
53  | break;  | 
54  | case 9600:  | 
55  | U0DLM = 0x01; /*9600 Baud Rate, 55.296.000 PCLK*/  | 
56  | U0DLL = 0x68; /*360dez=0x0168*/  | 
57  | break;  | 
58  | case 19200:  | 
59  | U0DLM = 0x00; /*19200 Baud Rate, 55.296.000 PCLK*/  | 
60  | U0DLL = 0x64; /*180dez=0x0064*/  | 
61  | break;  | 
62  | case 38400:  | 
63  | U0DLM = 0x00; /*38400 Baud Rate, 55.296.000 PCLK*/  | 
64  | U0DLL = 0x5A; /*90dez=0x005A*/  | 
65  | break;  | 
66  | case 76800:  | 
67  | U0DLM = 0x00; /*9600 Baud Rate, 55.296.000 PCLK*/  | 
68  | U0DLL = 0x68; /*45dez=0x003D*/  | 
69  | break;  | 
70  |     default:
 | 
71  |       //return(ERR_COM_INIT_LINE_SETTINGS);
 | 
72  | break;  | 
73  | |
74  |   }
 | 
75  | |
76  |   // Devisor Latch Access Bit(DLAB) disable
 | 
77  | ucTemp = 0;  | 
78  | ucTemp |= 0x00;  | 
79  | U0LCR = ucTemp;  | 
80  | |
81  |   //FIFO UART enable    
 | 
82  | U0FCR = 0x01;  | 
83  | return 1;  | 
84  | }
 |