[ECOS] read from user port

Katerina Malatara malatara@hotmail.com
Tue Mar 11 00:40:00 GMT 2003


hi,
i work with a e7t board and i try to read from user port. I have connect the 
user port with com2 of my PC.
The PC read some data from a file store them in a buffer and then it send 
them  through serial port to the board. The board must receive the data and 
response by sending some other data.

I use baudrate 38400.

The PC use this function in a loop in order to send all the data in the 
buffer
void outbyte(int fd, char c)
{
	int n;

	n = write(fd, &c, 1);
	if (n < 1) {
		printf("Error %d: Can't write to serial port\n",n);
		return;
	}
}

And board use the function
char inbyte(cyg_io_handle_t handle)
{
	char temp[1];
	Cyg_ErrNo n;
	cyg_uint32 len = 1;

	n = cyg_io_read(handle, temp, &len);
	if(n != ENOERR) {
		diag_printf("Error %d: Can't write to serial port\n",n);
		exit();
	}
	return (temp[0]);
}

but receive only the last character.

I can't understand where is the problem.

Please help me.



_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list