At 07:45 PM 8/3/02 +0100, you wrote: >I am using an F877 to produce a 10 bit A/D reading. This is combined into a >single variable. This is then passed to a binary to bcd routine which gives >me a single variable xxxx (i.e. 1023, 0963, 0053, 0007). I now want to sent >this to the terminal in the following format x.xxx (i.e. 1.023, 0.963, >0.053, 0.007). The serial comms is OK but I am not sure which is the best >method method to produce this output. > >Any suggestions please? So you have printf directed to the serial port? Best to avoid floating point numbers, they will probably add a lot of space to your program. How about this (untested) unsigned int x; // holds the ADC value from 0..1023 unsigned char y; // scratch variable for printing y = x/1000; // 0 <= x <= 65535 printf("%d.%3.3d", y, x-(y*1000)); Note that this compiler does not recognize the "0n" width specifier. Best regards, Spehro Pefhany --"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com 9/11 United we Stand -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body