AT90S8535_ADC转换应用程序及仿真.zip
时间:11-02 14:36
查看:1701次
下载:162次
简介:
本资料为AVR系列单片机竞赛设计实例程序22例PROTEUS仿真资料-AT90S8535_ADC转换应用程序及仿真。
//ICC-AVR application builder : 00-1-16 4:13:00
// Target : 8535
// Crystal: 4.0000Mhz
#include <io8535v.h>
#include <macros.h>
#define uchar unsigned char
#define uint unsigned int
#include <adc.h>
#include <led_dsp.h>
#include <dac.h>
void port_init(void)
{
PORTA = 0x00;
DDRA = 0x00;
PORTB = 0xFF;
DDRB = 0xFF;
PORTC = 0x00;
DDRC = 0xff;
PORTD = 0xF0;
DDRD = 0x0F;
}
void main (void)
{
uchar i;
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
adc_init();
dac_init ();
MCUCR = 0x00;
GIMSK = 0x00;
SEI(); //re-enable interrupts
//all peripherals are now initialised
while (1)
{
change_data(adc_val);
scan_led(disp_buffer);
// put_to_dac();
}
}