ADC 16-bits ICL7135

M

member_tdh

Guest
Hej!

Nu, Jeg har et projekt
vha. ADC ICL7135.Kan nogen hjælpe mig med nogen bekymring dokumenter og eksempelkode for det.I'm verry tak!

Henvisning din repply ...!

God ven!

Please help me!

<img src="http://www.edaboard.com/images/smiles/icon_exclaim.gif" alt="Udråbstegn" border="0" />
 
hej,

Denne url kan hjælpe dig

http://www.intersil.com/data/an/an054.pdf

 
Hej!

Tak for din hjælp!

Men jeg skrev koden for det, men ikke arbejde endnu.
I post fulde min kode (anvendes 93C46) her kan du ordne det for mig, please!?!

Thanhs mod så meget!

# ifndef _GLOBAL_INCLUDED_
# define _GLOBAL_INCLUDED_typedef usignerede CHAR BYTE;
typedef usignerede int WORD;

//------------------------------------------------ ----------------------------------------
/ / define DAC HC573
# define dulieu_DAC P0

sbit LE_573 = 0xA5;

//------------------------------------------------ ----------------------------------------
/ / Led
sbit LED_GREEN = 0xA6;

//------------------------------------------------ ----------------------------------------
/ / ADC 16-bits ICL7135 4 1 / 2 ciffer
sbit STB = 0xB2;
sbit POL = 0xB3;
sbit OVR = 0xB4;
sbit UNR = 0xB5;

sbit BCD1 = 0x90;
sbit BCD2 = 0x91;
sbit BCD4 = 0x92;
sbit BCD8 = 0x93;

sbit D1 = 0x94;
sbit D2 = 0x95;
sbit D3 = 0x96;
sbit D4 = 0x97;/ / 93c46
sbit cs = 0xB0;
sbit CLK = 0xB1;
sbit DIN = 0xB6;
sbit dout = 0xB7;

void Ewen (void);
void EWDS (void);
void WrCommand (usignerede CHAR);
void WRITE (usignerede CHAR, usignerede int);
usignerede int READ (usignerede CHAR);
void ERASE (usignerede CHAR);

//------------------------------------------------ ----------------------------------------void Init (void);
/ / void serial_init (void);

# endif#
include <AT89x52.h>
#
include "global.h"
#
include "intrins.h"

//------------------------------------------------ ----------------------------------------

void Main (void)
(
usignerede int result = 0;

Init ();

cs = 0;
CLK = 0;
DIN = 0;
dout = 0;
Ewen ();

WRITE (1,0 x0055);
result = READ (1);mens (1)
() / / ende, mens
) / / udgangen vigtigstevoid Init (indhold)
(
P0 = 0x00;
P1 = 0x00;
P2 = 0x00;
P3 = 0x00;)

/ *
void serial_init (void)
(
SCON = 0x50; / / mode 1: 8-bit UART, muliggøre receiver
TMOD | = 0x20; / / timeren 1 mode 2: 8-Bit reload
TH1 = 0xf3 / / reload værdi 2400 baud
TR1 = 1 / / timeren 1 kører
ES = 1 / / aktivere serielle port afbryder
)
* /

/ / Skriv aktivere skal gå forud for alle programmering transportformer
void Ewen (indhold)
(
cs = 0;
CLK = 0;
cs = 1;
_nop_ ();
WrCommand (0x98);
_nop_ ();
cs = 0;
)

/ / Deaktiverer alle programmerings instruktioner
void EWDS (void)
(
cs = 0;
CLK = 0;
cs = 1;
_nop_ ();
WrCommand (0x80);
_nop_ ();
cs = 0;
)

void ERASE (usignerede CHAR adr)
(
usignerede CHAR x;

Ewen ();
CLK = 0;
DIN = 1;
cs = 0;
_nop_ ();
cs = 1;
CLK = 1;
_nop_ ();
CLK = 0;
for (x = 8 x! = 0; x -)
(
DIN = addr &0x80;
CLK = 1;
_nop_ ();
adr <<= 1;
CLK = 0;
)
cs = 0;
dout = 1;
cs = 1;
CLK = 1;
while (dout == 0)
(
CLK = 0;
_nop_ ();
CLK = 1;
)
CLK = 0;
cs = 0;
EWDS ();
)

void WrCommand (usignerede CHAR InData)
(
usignerede CHAR x;

for (x = 0; x <9; x ) / / 9 pulser ur
(
DIN = InData &0x80; / / get DI pin
CLK = 1;
_nop_ ();
InData <<= 1;
CLK = 0;
)
/ / Cs = 0;
)

/ / Skriver hukommelsesplacering En - A0
void WRITE (usignerede CHAR adr, usignerede int InData)
(
usignerede CHAR x;

Ewen ();
CLK = 0;
DIN = 1;
cs = 0;
_nop_ ();
cs = 1;
CLK = 1;
_nop_ ();
CLK = 0;
/ / Addr = addr & 0x3f | 0x40;
addr = addr | 0x40;
for (x = 0; x <8; x )
(
if (addr & 0x80) DIN = 1;
ellers DIN = 0;
CLK = 1;
_nop_ ();
adr <<= 1;
CLK = 0;
)

_nop_ ();
for (x = 0; x <16 x )
(
DIN = InData &0x80;
CLK = 1;
_nop_ ();
InData <<= 1;
CLK = 0;
)
cs = 0;
dout = 0;
cs = 1;
CLK = 1;
while (dout == 0) / / optaget test
(
CLK = 0;
_nop_ ();
CLK = 1;
)
CLK = 0;
cs = 0;
EWDS ();
)

usignerede int READ (usignerede CHAR adr)
(
usignerede CHAR x;
usignerede int OutData = 0;

OutData = 0;
Ewen ();
CLK = 0;
DIN = 1;
cs = 0;
_nop_ ();
cs = 1;
_nop_ ();
CLK = 1;
_nop_ ();
CLK = 0;
/ / Addr = addr & 0x3f | 0x80;
addr = addr | 0x80;
for (x = 0; x <8; x )
(
if (addr & 0x80) DIN = 1;
ellers DIN = 0;
CLK = 1;
_nop_ ();
adr <<= 1;
CLK = 0;
)

dout = 1;
for (x = 0; x <16 x )
(
CLK = 1;
_nop_ ();
OutData = (OutData <<= 1) | dout;
CLK = 0;
_nop_ ();
)

CLK = 0;
cs = 0;
EWDS ();
tilbagevenden (OutData);
)

 
Hjælp mig pls!

<img src="http://www.edaboard.com/images/smiles/icon_exclaim.gif" alt="Udråbstegn" border="0" />
 

Welcome to EDABoard.com

Sponsor

Back
Top