Rules | Recent posts | topic RSS | Search | Register  | Log in

Printf statement...in ADUC-841

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> Embedded Systems and Real-Time OS
Author Message
selvan0201



Joined: 23 Feb 2008
Posts: 12
Helped: 1


Post30 Apr 2008 8:06   Printf statement...in ADUC-841

Hi Friends...
I am using Analog devices µC ADUC-841 for my application.I am using both adc and dac,and i am displaying the result in serial comm.window,at tat time I need 2 display only 12 bits.But it's displaying 16bits..I am using the printf statement (printf"%02BX %02BX\n",DATAH,DATAL)..Is it a correct way of displaying r anybody tell about this above statement.. Can anybody explain about the printf statement...


Thanks...In Advance...
Back to top
coshkun



Joined: 27 Aug 2005
Posts: 149
Helped: 8


Post30 Apr 2008 8:37   Re: Printf statement...in ADUC-841

If you just want to display the result you can sum the datah and datal in an int variable and send it to serial port
For example

int result;
result = (DATAH««Cool + DATAL;
Back to top
sos



Joined: 04 Apr 2008
Posts: 39


Post14 Jun 2008 15:16   Re: Printf statement...in ADUC-841

printf take the help from getchar sendchar ultimately so modify that according to what u want
Back to top
FvM



Joined: 22 Jan 2008
Posts: 2686
Helped: 439
Location: Bochum, Germany


Post14 Jun 2008 21:38   Re: Printf statement...in ADUC-841

With Keil C51, 16 bit values in two consecutive special function registers can be acessed by the sfr16 data type in a single C instruction. The definitions are not included in standard aduc8xx.h-files and have to be added.
Code:
sfr16 ADCDATA_L_H    = 0xD9;


12 bit data are extracted by bit mask operations, e. g. (ADCDATA_L_H & 0xfff).
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> Embedded Systems and Real-Time OS
Page 1 of 1 All times are GMT + 1 Hour


Abuse
Administrator
Moderators
topic RSS 
sitemap