Kommentar: Einfügen von HTML im Kommentar: Link einfügen: <a href="LINKURL" target="_blank">LINKTITEL</a> Bild einfügen: <img src="BILDURL"> Text formatieren: <b>fetter Text</b> <i>kursiver Text</i> <u>unterstrichener Text</u> Kombinationen sind auch möglich z.B.: <b><i>fetter & kursiver Text</i></b> C Quellcode formatieren: <code>Quellcode</code> BASIC Quellcode formatieren: <basic>Quellcode</basic> (Innerhalb eines Quellcodeabschnitts ist kein html möglich.) Wichtig: Bitte mache Zeilenumbrüche, bevor Du am rechten Rand des Eingabefeldes ankommst ! -> I > > Hello there, > > > > I only get characters return and not (hex) decimal characters ? > > > > Help? > > > > > > void main(void) > > { > > int ADC_Value; > > > > Serial_Init(0,SR_8BIT|SR_1STOP|SR_NO_PAR,SR_BD9600); > > > > while (true) > > { > > ADC_Set(0x40,0); > > ADC_Value = (ADC_Read()); > > Serial_WriteText(0,"AD0 = "); > > Serial_Write(0,ADC_Value); > > Serial_WriteText(0,":"); > > Serial_Write(0,CR); > > AbsDelay(100); > > } > > } > > > > Bram > > Dear Bram, > > the function "Serial_Write" send the value as a decimal value over the serial interface. > The representation are ASCII-values. That's the reason why you see characters. > As an example: If the AD-value is 65 digit you receive an "A". Please check for a > better understanding the ASCII-table: > <a href="http://www.c-control-pro.de/documentation/index.html?ascii_tabelle.htm" target="_blank">ASCII-table</a> > > For your task you must use another function: > > #define CR 0x0D > void main(void) > { > int ADC_Value; > char adc_string[10]; > > Serial_Init(0,SR_8BIT|SR_1STOP|SR_NO_PAR,SR_BD9600); > > while (true) > { > ADC_Set(0x40,0); > ADC_Value = (ADC_Read()); > Str_WriteInt(ADC_Value,adc_string,0); //Convert value to string > > Serial_WriteText(0,"AD0 = "); > Serial_WriteText(0,adc_string); //Send value as string > Serial_WriteText(0,":"); > Serial_Write(0,CR); > AbsDelay(100); > } > } > > Note: I have not tested the code, because I havn't an µC at present. It could be > that you must adjust it a little bit. But you can see the way of programming. > > Best regards, > Tobias