欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    LED数显太阳能充电控制器基本资料介绍.doc

    • 资源ID:4251503       资源大小:542KB        全文页数:28页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    LED数显太阳能充电控制器基本资料介绍.doc

    LED太阳能充电控制器原理图第一层原理图第二层原理图第三层原理图PCB版图拼版图(PCB)PCB打样仿真图仿真图(proteus)实物图实物图(1)实物图(2)实物图(3)源程序/*|=太阳能充电控制器=|使用芯片:ATMEGA8A软件设计人:何涛工程开始时间:2012.06.12联系电话:13798974197(珠海)QQ:562673469=|*/*74HC164.C*/#include "app.h"void Show_164(unsigned char _ShowValue) unsigned char Count0; for(Count0=0;Count0<=7;Count0+) if(_ShowValue&0x01)=0x01) PORTD=PORTD|0X01; /1 DATA else PORTD=PORTD&0XFE; /0 DATA _ShowValue>>=1; PORTD=PORTD&0XFD; /CLK 0 /delay(1); PORTD=PORTD|0X02; /CLK 1 /delay(10); PORTD=PORTD|0X02; /CLK 1 /*74HC164.H*/void Show_164(unsigned char _ShowValue);/*AD.C*/#include "app.h"/*ƬÄÚADC³õʼ»¯*/void ADC_Init(INT8U channel) /*¹¤×÷ÓÚµ¥´Îת»»Ä£Ê½ÏÂ*/ switch(channel)/ÄÚ²¿AREFµçѹ2.56V ADLARת»»½á¹ûÓÒ¶ÔÆë ÊäÈëͨµÀchannelcase 0:ADMUX=0xc0+0;break;case 1:ADMUX=0xc0+1;break;case 2:ADMUX=0xc0+2;break;case 3:ADMUX=0xc0+3;break;case 4:ADMUX=0xc0+4;break;case 5:ADMUX=0xc0+5;break;case 6:ADMUX=0xc0+6;break;case 7:ADMUX=0xc0+7;break;default:break; ADCSRA=0x00;/Æô¶¯×ª»» µ¥´Îת»» 16·ÖƵINT16U ADC_Start(INT8U channel) INT8U Temp_L; INT8U Temp_H;INT16U AD_Data;switch(channel)case 0:ADMUX=0xc0+0;break;case 1:ADMUX=0xc0+1;break;case 2:ADMUX=0xc0+2;break;case 3:ADMUX=0xc0+3;break;case 4:ADMUX=0xc0+4;break;case 5:ADMUX=0xc0+5;break;case 6:ADMUX=0xc0+6;break;case 7:ADMUX=0xc0+7;break;default:break; ADCSRA |=0xC0;/Æô¶¯ADת»» µ¥´Îת»» Temp_L=ADCL; Temp_H=ADCH;AD_Data=Temp_H*256+Temp_L;ADCSRA =0x80;/¹Ø±ÕADת»» µ¥´Îת»»switch(channel)case 0:ADMUX=0xc0+0;break;case 1:ADMUX=0xc0+1;break;case 2:ADMUX=0xc0+2;break;case 3:ADMUX=0xc0+3;break;case 4:ADMUX=0xc0+4;break;case 5:ADMUX=0xc0+5;break;case 6:ADMUX=0xc0+6;break;case 7:ADMUX=0xc0+7;break;default:break; ADCSRA |=0xC0;/Æô¶¯ADת»» µ¥´Îת»» Temp_L=ADCL; Temp_H=ADCH; AD_Data=Temp_H*256+Temp_L;ADCSRA =0x80;/¹Ø±ÕADת»» µ¥´Îת»»return(AD_Data);void AD_select(INT8U channel) switch(channel) case 0:LED_NUM20=ADC_Start(6)/4;break;/UXX.X ³Ë10±¶ ±ãÓÚÏÔʾ case 1:LED_NUM21=ADC_Start(7)/4;break;/AXX.X case 2:LED_NUM22=ADC_Start(0)/4;break;/bXX.X case 3:LED_NUM23=ADC_Start(1)/4;break;/CXX.X /*AD.H*/void ADC_Init(unsigned char channel);unsigned int ADC_Start(unsigned char channel);void AD_select(unsigned char channel);/*APP.H*/#include <iom8v.h>#include <macros.h>#include <eeprom.h>/#include "Kernel.h"/#include "task.h"#include "misc.h"#include "initial.h"#include "74HC164.h"#include "delay.h"#include "LED.h"#include "AD.h"#include "EEPROM.h"/*DELAY.H*/#include "app.h"unsigned int Min = 0;/·ÖÖÓunsigned int Sec = 0;/Ãëvoid delay(unsigned int a) unsigned int i,j; for(i=0;i<a;i+) for(j=0;j<500;j+);void SolarCount(void)/¼ÆËã¸÷λÏÔʾֵ Sec+; if (Sec>59) Sec = 0; Min +; /*DELAY.H*/extern unsigned int Min;/·ÖÖÓextern unsigned int Sec;/Ãëextern unsigned int Count,flag_count;/¼ÆÊývoid delay(unsigned int a);void SolarCount(void);/*EEPROM.H*/#include "app.h"void EEPROM_Init(void) INT8U i=0; flag_0 =EEPROMread(1); flag_3 =EEPROMread(4); flag_4 =EEPROMread(5); flag_5 =EEPROMread(6); flag_6 =EEPROMread(7); flag_7 =EEPROMread(8); flag_9 =EEPROMread(10); flag_10=EEPROMread(11);void EEPROM_Start(void) EEPROMwrite(1,flag_0); EEPROMwrite(4,flag_3); EEPROMwrite(5,flag_4); EEPROMwrite(6,flag_5); EEPROMwrite(7,flag_6); EEPROMwrite(8,flag_7);/125 EEPROMwrite(10,flag_9); EEPROMwrite(11,flag_10);void EEPROM_Recover(void) EEPROMwrite(1,6); EEPROMwrite(4,50); EEPROMwrite(5,108); EEPROMwrite(6,144); EEPROMwrite(7,0); EEPROMwrite(8,125); EEPROMwrite(10,0); EEPROMwrite(11,0); /*EEPROM.C*/void EEPROM_Init(void);void EEPROM_Start(void);void EEPROM_Recover(void);/*INITIAL.C*/#include "app.h"INT16U Time1=3;void Gpio_Init(void);void Timer1_Init(void);void Timer2_Init(void);void Interrupt_Init(void);void Battery_Init(void);void Hardware_Init(void) ADC_Init(6); EEPROM_Init(); Gpio_Init();Timer1_Init(); Timer2_Init(); Interrupt_Init();Battery_Init(); void Battery_Init(void) INT16U i=4,j=5; while(Time1)/6sµ¹¼Æʱ if(flag_count=1) Time1-;flag_count=0; Display4(Time1); while(i-) while(j-) Display1(windows_1,120); PORTD=0XFF; delay(1000); j=8; / delay(100); /*void Gpio_Init(void)DDRB = 0xDF; /PB5×öΪ°´¼üPORTB = 0x20; DDRC = 0x00;PORTC = 0xFF; DDRD = 0xFF; PORTD = 0xFF; /TIMER1 initialize - prescale:1024/ WGM: 0) Normal, TOP=0xFFFF/ desired value: 1Hz/ actual value: 1.000Hz (0.0%)void Timer1_Init(void) TCCR1B = 0x00; /stop TCNT1H = 0xFF; /setup TCNT1L = 0xB2; OCR1AH = 0x00; OCR1AL = 0x4E; OCR1BH = 0x00; OCR1BL = 0x4E; ICR1H = 0x00; ICR1L = 0x4E; TCCR1A = 0x00; TCCR1B = 0x05; /start Timer TIMSK |= 0x10;/Êä³ö±È½ÏAÆ¥ÅäÖжÏʹÄÜvoid Timer2_Init(void) TCCR2 = 0x00; /stop ASSR = 0x00; /set async mode TCCR2 = 0x0F; /start TCNT2 = 0x00; /setup OCR2 = 0x4D; TIMSK|= 0x80; void Interrupt_Init(void)SREG |= 0x80; /Enable Global Interrupt/*INITIAL.H*/void Hardware_Init(void);/*INTERPUTL.C*/#include "app.h"unsigned int Count=0,flag_count=0;/¼ÆÊý#pragma interrupt_handler Timer1_Interrupt:7void Timer1_Interrupt(void)/Clear Timer2 OCIF FlagTIFR |= 0x10; TCNT2 = 0x00;#pragma interrupt_handler Timer2_Interrupt:4void Timer2_Interrupt(void)TIFR |= 0x80;/Clear Timer2 OCIF Flag TCNT2 = 0x00;Count+;if(Count>100) Count=0; flag_count=1;/µ¹¼Æʱ1S±êÖ¾ SolarCount();/¼Æʱif(flag_timestart!=1)/¼Æʱ±ê־λÇåÁãMin=0;/ÓôËÖÖ·½Ê½ÒÖÖƼÆʱ/*LCD.C*/#include "app.h"INT8U LED_NUM=0x28,/*0*/ 0xEB,/*1*/ 0x32,/*2*/ 0xA2,/*3*/ 0xE1,/*4*/ 0xA4,/*5*/ 0x24,/*6*/ 0xEA,/*7*/ 0x20,/*8*/ 0xA0,/*9*/ 0x60,/*A*/ 0x25,/*b*/ 0x3C,/*C*/ 0x74,/*F*/ 0x29,/*U*/ 0xFF,/*È«ºÚ 15*/;/INT8U LED_NUM1=0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0x08,0x03,0x46,0x0E,0x41; /¹²Ñô¼«+СÊýµãINT8U LED_NUM1= 0x08,/*0*/ 0xCB,/*1*/ 0x12,/*2*/ 0x82,/*3*/ 0xC1,/*4*/ 0x84,/*5*/ 0x04,/*6*/ 0xCA,/*7*/ 0x00,/*8*/ 0x80,/*9*/ 0x40,/*A*/ 0x05,/*B*/ 0x1C,/*C*/ 0x54,/*F*/ 0x09,/*U*/ 0xFF,/*È«ºÚ 15*/ ;INT8U LED_NUM2=0,1,2,3;INT16U Fixed_Time=1,5,10,60,120,180,240,300,360,420,480,540,600,660,720;/14void Display2(INT8U value);void Display3(INT8U value);void Display1(INT8U windows,INT8U value) INT8U s=value; if(windows=0) /½çÃæ1 UXX.XÐîµç³Øµçѹ Show_164(LED_NUM14); PORTD=0XD8; delay(10); if(windows=1) /½çÃæ2 AXX.X B·Êä³öµçÁ÷ Show_164(LED_NUM10); PORTD=0XD8; delay(10); if(windows=2) /½çÃæ3 bXX.X A·Êä³öµçÁ÷ Show_164(LED_NUM11); PORTD=0XD8; delay(10); if(windows=3) /½çÃæ4 CXX.X ³äµçµçÁ÷ Show_164(LED_NUM12); PORTD=0XD8; delay(10); Show_164(LED_NUMs/100); PORTD=0X78; delay(10); Show_164(LED_NUM1s%100/10); PORTD=0XB8; delay(10); Show_164(LED_NUMs%10); PORTD=0XE8; delay(10); void Display2(INT8U value) INT8U s=value; Show_164(LED_NUM113); /F.XXX PORTD=0XD8; delay(10); Show_164(LED_NUM0); PORTD=0X78; delay(10); Show_164(LED_NUMs/10); PORTD=0XB8; delay(10); Show_164(LED_NUMs%10); PORTD=0XE8; delay(10); void Display3(INT8U value) INT8U s=value; Show_164(LED_NUMs/100); PORTD=0XD8; delay(10); Show_164(LED_NUM1s%100/10); PORTD=0X78; delay(10); Show_164(LED_NUMs%10); PORTD=0XB8; delay(10); Show_164(LED_NUM14); /XX.XU PORTD=0XE8; delay(10); void Display4(INT16U value)/ ÏÔʾXXXX INT16U t=value; Show_164(LED_NUMt/1000); PORTD=0XD8; delay(10); Show_164(LED_NUMt%1000/100); PORTD=0X78; delay(10); Show_164(LED_NUMt%100/10); PORTD=0XB8; delay(10); Show_164(LED_NUMt%10); PORTD=0XE8; delay(10); void Display5(INT16U value) INT16U t=value; /720min Show_164(LED_NUMt/100);/7 PORTD=0XD8; delay(10); Show_164(LED_NUMt%100/10);/2 PORTD=0X78; delay(10); Show_164(LED_NUMt%10);/0 PORTD=0XB8; delay(10); if(Count>50) Show_164(0XDF);/ÏÔʾСÊýµã else if(Count<51) Show_164(0XFF);/¹Ø±ÕСÊýµã PORTD=0XE8; delay(10); void Display(void) if(!(Enter1|Enter2|Enter3) /ËĽçÃæÇл» Display1(windows_1,LED_NUM2windows_1); if(Enter1) Display2(windows_2);/F.XXX if(Enter2) switch(windows_2) case 0:Display4(Fixed_Timeflag_0);break;/Êä³öA¶¨Ê±Ê±¼ä case 1:break;/A·µçÁ÷±£»¤Öµ case 2:break;/B·µçÁ÷±£»¤Öµ case 3:Display4(flag_3);break;/¹â¿Øµã case 4:Display3(flag_4);break;/Ƿѹ±£»¤Öµ /XX.XU case 5:Display3(flag_5);break;/¹ýѹ±£»§Öµ case 6:Display4(flag_6);break;/¹â¿ØÊÖ¶¯Çл» case 7:Display3(flag_7);break;/¹ý·Åµçѹ·µ»ØÖµ case 8:break;/µçѹÊÖ¶¯ÐÞÕý²¹³¥Öµ case 9:Display4(flag_9);break;/ÊýÂëÏÔʾ¿ª¹Ø case 10:Display4(flag_10);break;/USB_5VÊä³ö case 11:Display4(flag_11);break;/»Ö¸´³ö³§ÉèÖà default:break; else return; /*LCD.H*/void Display1(unsigned char windows,unsigned char value);void Display4(unsigned int value);void Display5(unsigned int value);void Display(void); /*MAIN.H*/#include "app.h"unsigned int i=0;void main(void)Hardware_Init();while(1) AD_select(i); if(i+>4)i=0; Key_Manage(); if(flag_timestart!=1)/·Ç¶¨Ê±Ä£Ê½ Display(); else if(flag_timestart=1)/¶¨Ê±Ä£Ê½ Display5(Fixed_Timeflag_0-Min); judgement(); performance(); LED_Control(); /*MISC.C*/#include "app.h"/*/*²ÎÊý±äÁ¿*/ INT8S flag_0=6;/10.8 INT8U flag_4=108;/10.8 INT8U flag_5=144;/14.4 INT8U flag_7=125;/12.5 INT8U flag_3=20; INT8S flag_6=0; INT8U flag_9=0; INT8U flag_10=0; INT8U flag_11=0; INT8U flag_timestart=0;/¿ªÆô¼Æʱ±ê־λ ¡°1 ¡±ÓÐЧ INT8U flag_light=0; /¹â¿Ø±ê־λ INT8U flag_wait=0; /´ý»ú/*/ INT8U Enter1=0; INT8U Enter2=0; INT8U Enter3=0;/*/ INT8U windows_1=0;/ËÄÖÖ½çÃæÇл» INT8S windows_2=0;/²ÎÊýºÅ½çÃ棨11ÖÖ£©/*/ INT8U flag_undervoltage=0;/Ƿѹ±ê־λ INT8U flag_overvoltage =0;/¹ý³äµç±ê־λ/*/ INT16U Time=4;/µ¹¼Æʱ/*/ INT8U OUT_A=0,OUT_B=0,CHA=0,CHB=0;/local function(s) declarationINT16U swGet_Key1(void);INT16U swGet_Key2(void);INT16U swGet_Key3(void);INT16U swGet_Key4(void);/*INT16U swGet_Key1(void)static INT16U wKeyStatus = 1;if(wKeyStatus = 1)if(PINB & (1 << Key_R) = 0) /Key PressedwKeyStatus = 0;else if(wKeyStatus = 0)if(PINB & (1 << Key_R) /Key ReleasedwKeyStatus = 1;return(true);return(false);/*INT16U swGet_Key2(void)static INT16U wKeyStatus = 1;if(wKeyStatus = 1)if(PINC & (1 << Key_S) = 0) /Key PressedwKeyStatus = 0;else if(wKeyStatus = 0)if(PINC & (1 << Key_S) /Key ReleasedwKeyStatus = 1;return(true);return(false);/*INT16U swGet_Key3(void)static INT16U wKeyStatus = 1;if(wKeyStatus = 1)if(PINC & (1 << Key_A) = 0) /Key PressedwKeyStatus = 0;else if(wKeyStatus = 0)if(PINC & (1 << Key_A) /Key ReleasedwKeyStatus = 1;return(true);return(false);/*INT16U swGet_Key4(void)static INT16U wKeyStatus = 1;if(wKeyStatus = 1)if(PINC & (1 << Key_B) = 0) /Key PressedwKeyStatus = 0;else if(wKeyStatus = 0)if(PINC & (1 << Key_B) /Key ReleasedwKeyStatus = 1;return(true);return(false);/*INT8U Key_Detection(void)if(swGet_Key1() = true)return 3;if(swGet_Key2() = true)return 4;if(swGet_Key3() = true)return 2;if(swGet_Key4() = true)return 1;return 0;/*void Key_Manage(void) switch(Key_Detection() case S: if(!(Enter1|Enter2|Enter3)Enter1=1;break;/½øÈë¶þ²ã½çÃæ if(Enter1=1)Enter2=1;Enter1=0;break;/½øÈëÈý²ã½çÃæ if(Enter2=1)Enter3=1;Enter2=0;/È·ÈÏ£¬±£´æ if(Enter3=1) while(Time) if(flag_count=1) Time-;flag_count=0; Display4(Time);if(flag_11=0)EEPROM_Start(); /±£´æÉèÖÃelse

    注意事项

    本文(LED数显太阳能充电控制器基本资料介绍.doc)为本站会员(laozhun)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开