MySerialPtr = AS1_Init(NULL); problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MySerialPtr = AS1_Init(NULL); problem

534 Views
MWMinor
Contributor V

I'm trying to use the ASerialLDD1 serial component - more specifically the RecvBlock and SendBlock functions.

I found the following code in the help on the component;

Component documentation - Typical Usage

volatile bool DataReceivedFlg = FALSE; char OutData[] = "Hello world"; char InpData[10]; LDD_TError Error; LDD_TDeviceData *MySerialPtr;  void main(void) {   . . .   MySerialPtr = AS1_Init(NULL);                                     /* Initialization of AS1 component */   for(;;) {     Error = AS1_ReceiveBlock(MySerialPtr, InpData, 1U);             /* Start reception of one character */     while (!DataReceivedFlg) {                                      /* Wait until 'e' character is received */     }     if (InpData[0] == 'e') {       Error = AS1_SendBlock(MySerialPtr, OutData, sizeof(OutData)); /* Send block of characters */     }     DataReceivedFlg = FALSE;   } }
 

But when I add this code to my project, I get an error message from the compiler;

MySerialPtr = AS1_Init(NULL);

too many agrumentsto function AS1_Init void value not ignored as it should be.

Has anyone else seen this or am I doing something wrong...?

0 Kudos
3 Replies

408 Views
MWMinor
Contributor V

Hi Erich

Thanks for getting back to me.

I added the line;

MySerialPtr = AS1_Init(NULL);

to the init_task within mqx_tasks.c

I noticed the header file AS1.h was in the main.c file, so added it to the mqx_tasks.c just to be sure but it made no difference.

When I try to compile the programme, the line MySerialPtr = AS1_Init(NULL); still returns an error indicating too many arguments to function AS1_init....

Appreciate the help with this....

Ken

0 Kudos

408 Views
BlackNight
NXP Employee
NXP Employee

Hi Ken,

I would search the sources for any AS1_Init (maybe you have something weird in there?).

And maybe have a look at the preprocessor listing to see from where this comes from?

I hope this helps,

Erich

0 Kudos

408 Views
BlackNight
NXP Employee
NXP Employee

The prototype is

LDD_TDeviceData* AS1_Init(LDD_TUserData *UserDataPtr)

so it really takes an argument.

Have you missed to include the header file?

#include "AS1.h"

?

I hope this helps,

Erich

0 Kudos