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.

[SOLVED] AD1674 with AT89C51 convert using 74HC74 and 74HC00

Status
Not open for further replies.

sherryliu

Member level 1
Joined
Jan 17, 2011
Messages
32
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,535
Hi all

Here is code of AD1674 with C51 convert.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <reg51.h>
#include <INTRINS.H> 
#include <STDIO.H>
 
 
sbit STATUS = P1^0;
 
unsigned char xdata CTRL _at_ 0x2FFF; //Why define CTRL at the external Address?
unsigned char xdata ADSEL _at_ 0x4FFF; //Why define ADSEL at the external Address?
unsigned char hByte;
unsigned char lByte;
 
void adc_Convert (void)
{ 
 
CTRL = 0x00; //Why assign 0x00 to the address? And What delegated for the CTRL?
ADSEL = 0x00; //Why assign 0x00 to the address?
 
while(STATUS==1);
 
CTRL = 0x02; //Why assign 0x02 to the address?
hByte = ADSEL; 
 
CTRL = 0x03; //Why assign 0x03 to the address?
lByte = ADSEL; 
}
 
 
void main(void)
{ unsigned int delay, MSB , LSB, adc_Res;
 
SCON = 0xDA; 
TMOD |= 0x20; 
TH1 = 0xFD; 
TR1 = 1; 
TI = 1; 
 
while(1)
{ 
adc_Convert();
MSB=(unsigned int)(hByte << 4);
LSB=(unsigned int)(lByte >> 4);
 
adc_Res = MSB + LSB;
 
printf("ADC READINGS: %03Xh\n", adc_Res);
 
for (delay=0; delay<10000; delay++) 
;
}
}



QQ Photo20160610232445.jpg




Please explain detail for me ,thanks for your help in advance!!
 

Hi, P0 of this chip is without internal pull up, so output 0xff to P0 to configure as an input port.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top