×

基于51的自动对光跟踪系统

消耗积分:5 | 格式:zip | 大小:68KB | 2014-08-04

陈刚

分享资料个

太阳能自动对光跟踪系统(单片机课程设计)

  #include《reg52.h》

  #include《stdio.h》

  #include “PCF8591.H”

  #define uchar unsigned char

  #define uint unsigned int

  #define PCF8591 0x90 //PCF8591 地址

  sbit ENTER = P3^3;

  sbit UP = P3^4;

  sbit DOWN = P3^5;

  sbit LEFT = P3^6;

  sbit RIGHT = P3^7;

  sbit LED1 = P1^0;

  sbit LED2 = P1^1;

  uchar Motor_Down[4]={0x08,0x04,0x02,0x01};

  uchar Motor_Up[4]={0x01,0x02,0x04,0x08};

  uchar Motor_Right[4]={0x10,0x20,0x40,0x80};

  uchar Motor_Left[4]={0x80,0x40,0x20,0x10};

  unsigned char AD_CHANNEL;

  //延时函数

  void Delay_ms(uint jj)

  {

  uint i;

  while(j--)

  for(i=0;i《125;i++);

  }

  void main() //函数功能:主函数

  {

  uchar AD_Up,AD_Down,AD_Left,AD_Right;

  uchar i,j,k=0;

  P0=0X00;

  Delay_ms(2000);

  while(1)

  {

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(0)
发评论

下载排行榜

全部0条评论

快来发表一下你的评论吧 !