Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - FAQ - Zum CC1-Forum - Zum CC-Pro-Forum

Re: sending data Kategorie: Programmierung (von M. Irskens - 24.01.2003 21:54)
Als Antwort auf sending data von Johan - 23.01.2003 14:06

Johan,

this is a very simple problem. You can read and send the values from the A/D ports as follows:

int x;
hwcom.init(); ' initialize COM to 9600 Baud, No Parity and 1 Stoppbit
x = ports.adc(1); ' read the value
hwcom.put(1); ' send the analog port number
hwcom.put(x / 256); ' send the high byte of the value
hwcom.put(x mod 256); ' send the low byte of the value
hwcom.put(13); ' send carriage return (e.g.) as end of record indicator for synchronization between records.

Depending on your reading equipment you must perhaps also define a startbyte, as the carriage return may also
be identical to a mesured value. This would rise problems in recognition of end of record.

I hope, this will help you a little bit to perform your task.

Regards
Michael

> I'm sorry to do it in english, but i dont speak german.
>
> My problem:
> i need an application, which can send the data from 4 analog ports to the (hardware) seriel com-port. How is this best done en can anyone tell me what sort of protocol is best to use.
>
> Can anyone help me, by an example of by some help ?!?
>
> Greetz Johan


    Antwort schreiben


Antworten: