|
1.對(duì)輸入的交流信號(hào)進(jìn)行實(shí)時(shí)轉(zhuǎn)換
2.通過LCD進(jìn)行實(shí)時(shí)顯示
3.proteus仿真
仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
單片機(jī)源程序如下:
- //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();
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
adc.zip
(76.19 KB, 下載次數(shù): 30)
2021-1-29 14:47 上傳
點(diǎn)擊文件名下載附件
|
評(píng)分
-
查看全部評(píng)分
|