Subj : Re: serial comm? To : borland.public.cpp.borlandcpp From : "Paul Wearne" Date : Sat Mar 06 2004 07:14 am You need both of the following:- /*************************************************************************** * * * FILENAME: $Workfile$ * * DESCRIPTION: * **************************************************************************** * CHANGE HISTORY: PVCS automatically inserts check in information. **************************************************************************** * $Log$ ***************************************************************************/ #ifndef _SCI0_H #define _SCI0_H /* LIBRARY INCLUDE FILES */ /* PROJECT INCLUDE FILES */ #include "targettypes.h" /* GLOBAL SYMBOLIC CONSTANTS */ /* GLOBAL MACROS DEFINITIONS */ /* GLOBAL ENUM DEFINITIONS */ /* GLOBAL STRUCT DEFINITIONS */ /* GLOBAL TYPE DEFINITIONS */ /* GLOBAL VARIABLE DECLARATIONS */ /* GLOBAL FUNCTION PROTOTYPES */ /*************************************************************************** * * FUNCTION: SCI0_Initialise * DESCRIPTION: * Configures the SCI peripheral device for asynchronous serial * communications. The SCI shall be configured at the specified baud rate, * with 8 bits, 1 stop bit and no parity. * Parameters list:- * U16 baud. This is the asynchronous baud rate, typical values are:- * 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400 * Return Value * BOOL If TRUE the SCI has been successfully configured. * IF FALSE the SCI could not be configured. * **************************************************************************** * Modification History **************************************************************************** * Initial Implementation ***************************************************************************/ BOOL SCI0_Initialise(U16 baud); /*************************************************************************** * * FUNCTION: SCI0_Read * DESCRIPTION: * Reads up to in_buffer_length bytes into the supplied in_buffer_ptr, * providing there is data in the SCI's peripheral receive buffer. * If in_buffer_ptr is null no data is placed in in_buffer_ptr. The SCI's * buffer is still emptied and the number of bytes emptied is return. * Parameters list:- * U8* in_buffer_ptr. Buffer in which the received data should be placed. * U16 in_buffer_length. The size of in_buffer_ptr. * Return Value * U16 Returns the number of bytes placed into the in_buffer_ptr. * **************************************************************************** * Modification History **************************************************************************** * Initial Implementation ***************************************************************************/ U16 SCI0_Read(U8* in_buffer_ptr, U16 in_buffer_length); /*************************************************************************** * * FUNCTION: SCI0_Write * DESCRIPTION: * Writes the contents of buffer specified by out_buffer_ptr into the SCI's * peripheral transmit buffer. If the SCI's transmit buffer is full it * shall wait until the SCI has emptied the buffer before continuing to load * the transmit buffer. * Parameters list:- * const U8* out_buffer_ptr. Buffer which contains the data for transmission. * U16 out_buffer_length. Number of elements in the out_buffer_ptr which require transmission. * Return Value * none * **************************************************************************** * Modification History **************************************************************************** * Initial Implementation ***************************************************************************/ void SCI0_Write(const U8* out_buffer_ptr, U16 out_buffer_length); #endif /* EOF */ /*************************************************************************** * * * FILENAME: $Workfile:$ * * DESCRIPTION: * * This module defines standards types to be used instead of the long style * ansi 'C' standard types. * Using these types will increase the portability and readability of the code. * This is a target specific file and will need modification depending on the * target processor and compiler. * **************************************************************************** * CHANGE HISTORY: PVCS automatically inserts check in information. **************************************************************************** * $Log:$ ***************************************************************************/ #ifndef _TARGETTYPES_H #define _TARGETTYPES_H #ifndef _WIN32 /* LIBRARY INCLUDE FILES */ /* PROJECT INCLUDE FILES */ /* GLOBAL SYMBOLIC CONSTANTS */ #define FALSE (0) #define TRUE (1) /* GLOBAL MACROS DEFINITIONS */ /* GLOBAL ENUM DEFINITIONS */ /* GLOBAL STRUCT DEFINITIONS */ /* GLOBAL TYPE DEFINITIONS */ typedef unsigned char CHAR; typedef unsigned char BOOL; typedef unsigned char U8; typedef signed char S8; typedef unsigned short U16; typedef signed short S16; typedef unsigned long U32; typedef signed long S32; typedef float F32; /* GLOBAL VARIABLE DECLARATIONS */ /* GLOBAL FUNCTION PROTOTYPES */ #else /* LIBRARY INCLUDE FILES */ #include /* PROJECT INCLUDE FILES */ /* GLOBAL SYMBOLIC CONSTANTS */ /* GLOBAL MACROS DEFINITIONS */ /* GLOBAL ENUM DEFINITIONS */ /* GLOBAL STRUCT DEFINITIONS */ /* GLOBAL TYPE DEFINITIONS */ typedef unsigned char U8; typedef signed char S8; typedef unsigned short U16; typedef signed short S16; typedef unsigned long U32; typedef signed long S32; typedef float F32; /* GLOBAL VARIABLE DECLARATIONS */ /* GLOBAL FUNCTION PROTOTYPES */ #endif #endif /* EOF */ "ge" wrote in message news:8a8h40t8tursthob8vbiuicr6ed12ma6km@4ax.com... > On Fri, 5 Mar 2004 13:45:30 -0000, "Paul Wearne" > wrote: > > >The attached files might help. > > > >I use the PC's serial port to simulate the serial port of an > >Microcontroller, therefore the file names may seem a bit confusing. > > > >It does Rx and Tx with no hardware handshaking. The received data is > >buffered by windows. > > > >Hope this helps. > > > > .... > >/* PROJECT INCLUDE FILES */ > >#include "sci0.h" > > Not to seem greedy, but could you include this file, too? > > Thanks. And, thanks for the quick reply. > > George .