Are you actually allocating space for SerErr somewhere?
In the snippet below, you're declaring a pointer to an Err:
Err * SerErr;
but this pointer points to garbage. When you pass the pointer SerErr to
SerSend(), you're passing it a pointer to some garbage area, and if it
tries to insert an error code in that garbage area, you'll have problems.
Regards,
Ben Flaumenhaft
>I am getting the following error when I call SerSend.
>
>DEX 1.0 reports "SerialMgr68328.c Line 904, null ref" ...
>
>Hopefully here is a code snippet that will hopefully show clearly and
>simply how I am a idiot.
>
>Err *SerErr;
>UInt RefNumber;
>
>void tx_byte(char ch)
>{
> static char tmp;
>
> tmp = ch;
> SerSend(RefNumber,&tmp,1,SerErr);
>}
>
>
>........
> err = SysLibFind("Serial Library",&RefNumber);
> ErrFatalDisplayIf(err!=0,"sysLibFind");
>
>
> err = SerOpen(RefNumber,0,9600);
> ErrFatalDisplayIf(err!=0,"SerOpen");
>
> SerSettingsType serial;
> serial.baudRate= 9600;
> serial.ctsTimeout = serDefaultCTSTimeout;
> serial.flags = serSettingsFlagBitsPerChar8 |
> serSettingsFlagStopBits1;
> err = SerSetSettings(RefNumber,&serial);
> ErrFatalDisplayIf(err!=0,"SerSetSettings");
>...
> tx_byte(ENQ);
>
>
>
>I have looked at all the examples of setting up a serial connection
>that I can find and I can't see what I am missing.
>
>Thanks