Eneko,
Pardon mi tentativa d�bil en intentar explicar en espa�ol. Utilizo un traductor del lenguaje as� que espero el sentido de las
marcas de la explicaci�n despu�s de la traducci�n.
Para intentarle y ayudar que necesito entenderle aplicaci�n mejor. Hay dos maneras de recibir datos seriales. El primer deber�a votar el dispositivo serial y el proceso los datos
y el segundo ser�a recibir una secuencia de datos continua o
sincronizada del intervalo que viene del dispositivo serial. Siempre que tenga una opci�n mi preferance debe votar (pida el
dispositivo datos) cuando soy listo procesarlo.
De acuerdo con que usted el ejemplo es se parece como si usted reciba
una secuencia continua de datos y entonces borrando el almacenador
intermediario antes de que le�do usted destruya los datos ya en el
almacenador intermediario y le tienen que esperar el dispositivo para
retransmitir antes de que haya datos v�lidos y el acceso de
comunicaci�n ley� el ciclo esperar� el untill o recibe datos del
bufer o el untill el per�odo del descanso fue alcanzado. (el valor por defecto es 5 segundos).
Para ayudarle tan que necesito mejor saber un par de cosas.
1. �Tengo raz�n en si se asume que usted recibe datos en un intervalo
fijo del dispositivo serial?
2. �Cu�l es retraso entre las transmisiones?
3. Cu�l es la longitud de la cadena de los datos vuelta, �y es la misma longitud cada vez?
4. �Hay un car�cter o un conjunto espec�fico de caracteres que indican
el extremo de la cadena de los datos?
For clarity sake, my reply in English:
Eneko,
In order to try and help you I need to understand you application better. There is two ways of of receiving serial data. The first would be to poll the serial device and the process the data and the second would be to receive a continuous or a timed interval data stream coming from the serial device. Whenever I have a choice my preferance is to poll (ask the device for data) when I am ready to process it.
Based on you example is seems as if you receive a continuous stream of data and then by clearing the buffer before a read you destroy the data already in the buffer and you have to wait for the device to retransmit before there is valid data and the communication port read cycle will wait untill it either receives data from the bufer or untill the timeout period was reached. (default value is 5 seconds).
So in order to help you better I need to know a couple of things.
1. Am i right in assuming that you receive data at a fixed interval from the serial device?
2. What is the time delay between transmissions?
3. What is the length of the data string returned, and is it the same length every time?
4. Is there a specific character or set of characters indicating the end of the data string?
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd