PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : راه اندازي ad7799 در ccs



ali_elect62
22-12-2009, 23:27
ad7799

سلام

ad7799 یک ای سی خیلی جالبی که هم ولتاژ ورددی تقویت میکنه و هم تبدیل به دیجیتال میکنه(24bit)
لطفا"کمک کنید این آی سی در ccs راه اندازی کنیم تا همگی بتونیم از این آی سی استفاده کنیم.
قیمتشم حدود 10000تومان
اینم دیتاشیتش


You can see links before reply

aliAVR
23-12-2009, 08:36
اقا لينك خرابه

ali_elect62
24-12-2009, 22:55
You can see links before reply

ali_elect62
08-01-2010, 18:28
من برنامه زیر و برای راه اندازی AD7799 استفاده کردم ولی جواب نمیده اگر کسی میتونه برنامه اصلاح کننه ،ممنون میشم


datasheet AD779
You can see links before reply




#include <16F877.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

// SPI chip select pin
#define AD7799_CS PIN_C0
#define AD7799_DI PIN_C4
#define AD7799_DO PIN_C5
#define AD7799_CLK PIN_C3
// SPI mode definitions (for 16F and 18F PICs).
#define SPI_MODE_0 (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_1 (SPI_L_TO_H)
#define SPI_MODE_2 (SPI_H_TO_L)
#define SPI_MODE_3 (SPI_H_TO_L | SPI_XMIT_L_TO_H)

// AD7799 commands
#define AD7799_READ_DATA_CMD 0x58
#define AD7799_WRITE_CONFIG_CMD 0x10
#define use_portb_lcd TRUE
#include <lcd.c>

//---------------------------------------
// Call this function to read the 24-bit A/D result
// from the AD7799.
int32 ad7799_read_data(void)
{
int32 retval;
int8 msb, mid, lsb;

output_low(AD7799_CS);

spi_write(AD7799_READ_DATA_CMD);
msb = spi_read(0); // Data comes out MSB first
mid = spi_read(0);
lsb = spi_read(0);
output_high(AD7799_CS);

// Convert the data bytes into a 32-bit value.
retval = make32(0, msb, mid, lsb);

return(retval);
}

//---------------------------------------
// Call this function to write a 16-bit value
// to the AD7799 Configuration register.
void ad7799_write_config(int16 config)
{
output_low(AD7799_CS);
spi_write(AD7799_WRITE_CONFIG_CMD);
spi_write(config >> 8); // Write MSB first
spi_write(config); // then write the LSB
output_high(AD7799_CS);
}

//---------------------------------------
// Setup the hardware SPI module in the PIC.
// The AD7799 uses SPI mode 3. The maximum SPI clock
// rate is 2.5 MHz. For a 20 MHz PIC, the closest
// clock divisor that will work is 16, giving 1.25 MHz.
// Initialize the chip select pin to the inactive state.
// Do the required 500 ms initial delay mentioned on
// page 19 of the AD7799 data sheet.
void ad7799_init(void)
{
setup_spi(SPI_MASTER | SPI_MODE_3 | SPI_CLK_DIV_16);

output_high(AD7799_CS);

delay_ms(500); // Startup delay

// Channel = 0, Gain Select = 0, Unipolar, 2.5v input range
ad7799_write_config(0x0010);

}

//====================================
void main()
{
int32 result;

ad7799_init();
lcd_init();

// Read the AD7799 every 500ms and display the result.
while(true)
{
result = ad7799_read_data(); // Get 24-bit A/D value
printf("%lx \n\r", result);
printf(lcd_putc,"%u",result);
lcd_gotoxy(1,8);
lcd_putc(result);
delay_ms(500);

}