CDN加速镜像 | 设为首页 | 加入收藏夹
当前位置: 首页 资源下载 源码下载 嵌入式/单片机编程 单片机(51,AVR,MSP430等)

文件名称:AVR Studio例子

  • 所属分类:
  • 标签属性:
  • 上传时间:
    2020-08-07
  • 文件大小:
    296.06kb
  • 已下载:
    0次
  • 提 供 者:
  • 相关连接:
  • 下载说明:
    别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容来自于网络,使用问题请自行百度

/*
* ADC.c
*
* Created: 22-5-2011 8:22:10 PM
* Author: Wingston
*/
#include <avr/io.h>
#include <avr/interrupt.h>

uint16_t ReadChannel(int mux);

int main (void)
{
  DDRC = 0xFF;
  uint16_t adcval = 0;
  while(1){
    adcval = ReadChannel(0);
    if(adcval <400)
    {
        PORTC = 0;
    }
    else
    {
      PORTC = 0xFF;
    }
  }    
}

uint16_t ReadChannel(int mux)
{
  uint8_t i;
  uint16_t result = 0;

  ADCSRA = (1<<ADEN) | (1<<ADPS1) | (1<<ADPS0);
  ADMUX = mux; // channel select
  ADMUX |= (1<<REFS1) | (1<<REFS0); // VCC

  ADCSRA |= (1<<ADSC); // start ADC
  while ( ADCSRA & (1<<ADSC) ) {
  ;
  }

  for(i=0;i<4;i++)
  {
    ADCSRA |= (1<<ADSC);
    while ( ADCSRA & (1<<ADSC) ) {
    ;
    }
    result += ADCW;
  }
  
  ADCSRA &= ~(1<<ADEN); // ADC deactivate (2)
  result /= 4;
  return result;
}
(系统自动生成,下载前可以参看下载内容)

下载文件列表

压缩包 : AVR-Examples-master.zip 列表
AVR-Examples-master/
AVR-Examples-master/ADC/
AVR-Examples-master/ADC/ADC.avrsln
AVR-Examples-master/ADC/ADC.avrsuo
AVR-Examples-master/ADC/ADC/
AVR-Examples-master/ADC/ADC/ADC.avrgccproj
AVR-Examples-master/ADC/ADC/ADC.c
AVR-Examples-master/ADC/ADC/Debug/
AVR-Examples-master/ADC/ADC/Debug/ADC.d
AVR-Examples-master/ADC/ADC/Debug/ADC.eep
AVR-Examples-master/ADC/ADC/Debug/ADC.elf
AVR-Examples-master/ADC/ADC/Debug/ADC.hex
AVR-Examples-master/ADC/ADC/Debug/ADC.lss
AVR-Examples-master/ADC/ADC/Debug/ADC.map
AVR-Examples-master/ADC/ADC/Debug/ADC.o
AVR-Examples-master/ADC/ADC/Debug/Makefile
AVR-Examples-master/ADC/ADC/Debug/Outputfile.d
AVR-Examples-master/AVRDude/
AVR-Examples-master/AVRDude/AVRDude/
AVR-Examples-master/AVRDude/AVRDude/avrdude.conf
AVR-Examples-master/AVRDude/AVRDude/avrdude.exe
AVR-Examples-master/AVRDude/AVRDude/libusb0.dll
AVR-Examples-master/AVRDude/AVRDude/libusb0.sys
AVR-Examples-master/AVRDude/AVRDude/usbtinyisp.cat
AVR-Examples-master/AVRDude/AVRDude/usbtinyisp.inf
AVR-Examples-master/Blinking_LED/
AVR-Examples-master/Blinking_LED/Blinking_LED.avrsln
AVR-Examples-master/Blinking_LED/Blinking_LED.avrsuo
AVR-Examples-master/Blinking_LED/Blinking_LED/
AVR-Examples-master/Blinking_LED/Blinking_LED/Blinking_LED.avrgccproj
AVR-Examples-master/Blinking_LED/Blinking_LED/Blinking_LED.c
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.d
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.eep
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.elf
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.hex
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.lss
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.map
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Blinking_LED.o
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Makefile
AVR-Examples-master/Blinking_LED/Blinking_LED/Debug/Outputfile.d
AVR-Examples-master/LCD_test/
AVR-Examples-master/LCD_test/LCD_test.avrsln
AVR-Examples-master/LCD_test/LCD_test.avrsuo
AVR-Examples-master/LCD_test/LCD_test/
AVR-Examples-master/LCD_test/LCD_test/Debug/
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.d
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.eep
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.elf
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.hex
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.lss
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.map
AVR-Examples-master/LCD_test/LCD_test/Debug/LCD_test.o
AVR-Examples-master/LCD_test/LCD_test/Debug/Makefile
AVR-Examples-master/LCD_test/LCD_test/Debug/Outputfile.d
AVR-Examples-master/LCD_test/LCD_test/LCD_test.avrgccproj
AVR-Examples-master/LCD_test/LCD_test/LCD_test.c
AVR-Examples-master/LCD_test/LCD_test/lcd.h
AVR-Examples-master/PWM/
AVR-Examples-master/PWM/PWM.avrsln
AVR-Examples-master/PWM/PWM.avrsuo
AVR-Examples-master/PWM/PWM/
AVR-Examples-master/PWM/PWM/Debug/
AVR-Examples-master/PWM/PWM/Debug/Makefile
AVR-Examples-master/PWM/PWM/Debug/Outputfile.d
AVR-Examples-master/PWM/PWM/Debug/PWM.d
AVR-Examples-master/PWM/PWM/Debug/PWM.eep
AVR-Examples-master/PWM/PWM/Debug/PWM.elf
AVR-Examples-master/PWM/PWM/Debug/PWM.hex
AVR-Examples-master/PWM/PWM/Debug/PWM.lss
AVR-Examples-master/PWM/PWM/Debug/PWM.map
AVR-Examples-master/PWM/PWM/Debug/PWM.o
AVR-Examples-master/PWM/PWM/PWM.avrgccproj
AVR-Examples-master/PWM/PWM/PWM.c
AVR-Examples-master/avr_interrupt/
AVR-Examples-master/avr_interrupt/avr_interrupt.avrsln
AVR-Examples-master/avr_interrupt/avr_interrupt.avrsuo
AVR-Examples-master/avr_interrupt/avr_interrupt/
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/Makefile
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/Outputfile.d
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.d
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.eep
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.elf
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.hex
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.lss
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.map
AVR-Examples-master/avr_interrupt/avr_interrupt/Debug/avr_interrupt.o
AVR-Examples-master/avr_interrupt/avr_interrupt/avr_interrupt.avrgccproj
AVR-Examples-master/avr_interrupt/avr_interrupt/avr_interrupt.c
AVR-Examples-master/test/
AVR-Examples-master/test/test.avrsln
AVR-Examples-master/test/test.avrsuo
AVR-Examples-master/test1/
AVR-Examples-master/test1/test1.avrsln
AVR-Examples-master/test1/test1.avrsuo
AVR-Examples-master/test1/test1/
AVR-Examples-master/test1/test1/Debug/
AVR-Examples-master/test1/test1/Debug/Makefile
AVR-Examples-master/test1/test1/Debug/Outputfile.d
AVR-Examples-master/test1/test1/Debug/test1.d
AVR-Examples-master/test1/test1/Debug/test1.eep
AVR-Examples-master/test1/test1/Debug/test1.elf
AVR-Examples-master/test1/test1/Debug/test1.hex
AVR-Examples-master/test1/test1/Debug/test1.lss
AVR-Examples-master/test1/test1/Debug/tes

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 搜珍网是交换下载平台,只提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。更多...
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或换浏览器;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*快速评论: 推荐 一般 有密码 和说明不符 不是源码或资料 文件不全 不能解压 纯粹是垃圾
*内  容:
*验 证 码:
搜珍网 www.dssz.com