F615单片机编程实例.docVIP

  • 46
  • 0
  • 约3.19千字
  • 约 6页
  • 2018-06-03 发布于福建
  • 举报
经过一段时间的摸索,终于解决PIC12F615单片机的AD、定时器、PWM等程序测试,编译工具MPLAB IDE v8.92,仿真和实物测试完全适用,为以后有做与PIC单片机相关测试的同学留个参考,无需再从0看起~ AD部分: ? ?? ?? ? #includepic.h#define uchar unsigned char #define uint??unsigned int __CONFIG(0x3C64); void delay(uint x); void init(); uint get_ad(); void main() { ? ? ? ? init(); ? ?? ? while(1) ? ?? ?{? ?? ??? ? ?? ???GPIO=get_ad(); ? ?? ?} }? void delay(uint x) { ? ? ? ? uint a,b; ? ? ? ? for(a=x;a0;a--) ? ? ? ? for(b=110;b0;b--); } void init() { ? ? ? ?? ?? ? TRISIO=0x08; ? ?? ?? ?? ???GPIO=0x00; ? ?? ?? ?? ? ANSEL=0x71; ? ? ? ?? ?? ? ADCON0=0x01; ? ?? ?? ?? ???delay(20); } uint get_

文档评论(0)

1亿VIP精品文档

相关文档