Advertisement

基于单片机太阳能自动双轴追光电路仿真系统(毕设课设)

阅读量:

利用51单片机做的一个双轴自动追光系统,可以用于太阳能充电系统的寻光自动化,从水平和纵向两个方向找到最佳光源点,实现能源利用最大化。

【资源下载】下载地址如下(907):https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

复制代码
 #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^2;
    
 sbit LED2 = P1^3;
    
 uchar Motor_Up[4]={0x08,0x04,0x02,0x01};
    
 uchar Motor_Down[4]={0x01,0x02,0x04,0x08};
    
  
    
  
    
 uchar Motor_Left[4]={0x10,0x20,0x40,0x80};
    
 uchar Motor_Right[4]={0x80,0x40,0x20,0x10};
    
  
    
 unsigned char AD_CHANNEL;
    
 //延时函数
    
 void Delay_ms(uint jj)
    
 {
    
 	uint ii;
    
 	while(jj--)
    
 		for(ii=0;ii<125;ii++);
    
 }
    
 void UART_Init(void)
    
 {
    
      TMOD = 0x20;   //定时器模式选择
    
      PCON = 0x00;
    
      SCON = 0x50;			
    
      TH1 = 0xFd;    //设置波特率 9600
    
      TL1 = 0xFd;
    
      TR1 = 1;		//启动定时器1
    
 	 ES = 1;		//开串口中断
    
 	 EA = 1;		//开总中断		
    
 }
    
    
    
    
    
![](https://ad.itadn.com/c/weblog/blog-img/images/2025-08-16/DEWFuyl0TwgJNLaMxRi3d1sXhKOQ.png)

全部评论 (0)

还没有任何评论哟~