Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Printf statement...in ADUC-841

Status
Not open for further replies.

selvan0201

Junior Member level 1
Junior Member level 1
Joined
Feb 23, 2008
Messages
17
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,389
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...
 

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««8) + DATAL;
 

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

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).
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top