• 1126786998@qq.com
    了解作者
  • C/C++
    开发工具
  • 23KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 0
    下载次数
  • 2020-01-13 13:46
    上传日期
STC12C5A60S2输出华星65GOA控制G2595E时序
STC12C5A60S2.zip
  • 最终版2
  • 2ch_uvopt.bak
    55.2KB
  • 2ch.M51
    6.7KB
  • 2ch.Uv2.bak
    2.1KB
  • 2ch.OBJ
    6.4KB
  • 2ch.uvopt
    55.2KB
  • 2ch
    5.8KB
  • 2ch.lnp
    38B
  • 2ch_Opt.Bak
    1KB
  • 2ch.plg
    175B
  • 2ch.hex
    567B
  • 2ch.c
    5KB
  • 2ch.uvproj
    12.9KB
  • 2ch.LST
    8.5KB
  • 2ch.opt.bak
    1KB
内容介绍
/*------------------------------------------------------------------*/ /* --- STC MCU Limited ---------------------------------------------*/ /* --- STC12C5Axx Series MCU PCA module output PWM wave Demo -------*/ /* --- Mobile: (86)13922805190 -------------------------------------*/ /* --- Fax: 86-0513-55012956,55012947,55012969 ---------------------*/ /* --- Tel: 86-0513-55012928,55012929,55012966----------------------*/ /* --- Web: www.STCMCU.com -----------------------------------------*/ /* --- Web: www.GXWMCU.com -----------------------------------------*/ /* If you want to use the program or the program referenced in the */ /* article, please specify in which data and procedures from STC */ /*------------------------------------------------------------------*/ #include "reg51.h" #include "intrins.h" #define FOSC 11059200L typedef unsigned char BYTE; typedef unsigned int WORD; /*Declare SFR associated with the PCA */ sfr CCON = 0xD8; //PCA control register sbit CCF0 = CCON^0; //PCA module-0 interrupt flag sbit CCF1 = CCON^1; //PCA module-1 interrupt flag sbit CR = CCON^6; //PCA timer run control bit sbit CF = CCON^7; //PCA timer overflow flag sfr CMOD = 0xD9; //PCA mode register sfr CL = 0xE9; //PCA base timer LOW sfr CH = 0xF9; //PCA base timer HIGH sfr CCAPM0 = 0xDA; //PCA module-0 mode register sfr CCAP0L = 0xEA; //PCA module-0 capture register LOW sfr CCAP0H = 0xFA; //PCA module-0 capture register HIGH sfr CCAPM1 = 0xDB; //PCA module-1 mode register sfr CCAP1L = 0xEB; //PCA module-1 capture register LOW sfr CCAP1H = 0xFB; //PCA module-1 capture register HIGH sfr PCAPWM0 = 0xf2; sfr PCAPWM1 = 0xf3; unsigned char delay1; // STV和BLANK间隔时间 unsigned char delay3; //CPV1和CPV2间隔时间 unsigned char delay2; // STV和CPV1间隔时间 unsigned char STVW; //STV正脉冲时间 unsigned char STV; //STV周期时间 unsigned char BLANK;//BLANK周期时间 unsigned char BS;//BLANK正脉冲时间 unsigned char LC;//LC和BLANK间隔时间 unsigned char LCS;//LC正脉冲时间 unsigned char CPV1;//CPV1周期时间 unsigned char CPV1S;//CPV1正脉冲时间 unsigned char CPV2;//CPV2周期时间 unsigned char CPV2S;//CPV2正脉冲时间 unsigned char T5; // CPV1和CPV2间隔时间 unsigned char US; //1us标志数 unsigned char TENMS; //10MS标志数 unsigned char ms; //0.MS标志数 unsigned char TENTHS;//0.1S标志数 unsigned char i; unsigned char j; sbit STV1_O=P1^0;//STV1输出引脚 sbit STV2_O=P1^1;//STV2输出引脚 sbit BLANK_O=P1^2;//BLANK输出引脚 sbit LC1_O=P2^3;//LC1输出引脚 sbit LC2_O=P2^4;//LC1输出引脚 sbit CPV1_O=P1^5;//CPV1输出引脚 sbit CPV2_O=P1^6;//CPV2输出引脚 sbit K1=P3^5;//启动时序开关 void init() { TMOD=0x10; //定时器1以方式1定时 TL1 = 0x18; //设置定时初值 TH1 = 0x7F; //设置定时初值 EA=1; //打开总中断 ET1=1; //允许定时器1中断 TR1=1; //开启定时器1 } void time1() interrupt 3 //定时器1中断函数 { // CR = 0; //PCA timer start off CCON = 0; //Initial PCA control register //Clear all module interrupt flag CL = 0; //Reset PCA base timer CH = 0; TL1 = 0x18; //设置定时初值 TH1 = 0x7F; //设置定时初值 BLANK_O=1;//BLANK输出高电平 CPV1_O=CPV2_O=0;//CPV1.2输出低电平1 i = 87;//延时30us while (--i); BLANK_O=0; _nop_(); _nop_(); i = 1; j = 205; do { while (--j); } while (--i); //延时35us LC++; if(LC==200)//200针翻转一次 { LC1_O=!LC1_O; LC2_O=!LC2_O; } _nop_(); _nop_(); i = 1; j = 205; do { while (--j); } while (--i); //延时35us STV1_O=STV2_O=1; i = 57;//延时10us while (--i); CCAP0H = 0x80; CCAP0L = 0x30; //PWM0 port output 50% duty cycle square wave CCAPM0 = 0x42; //PCA module-0 work in 8-bit PWM mode and no PCA interrupt CCAP1H = CCAP1L = 0xff; //PWM1 port output 0% duty cycle square wave PCAPWM1 = 0x03; CCAPM1 = 0x42; //PCA module-1 work in 8-bit PWM mode and no PCA interrupt CR = 1; //PCA timer start run i = 87; while (--i); //延时15us STV1_O=STV2_O=0; i = 87; while (--i); //延时15us CCAP1H = 0x80; CCAP1L = 0x30; //PWM1 port output 0% duty cycle square wave PCAPWM1 = 0x30; } void main() { init(); CCON = 0; //Initial PCA control register //PCA timer stop running //Clear CF flag //Clear all module interrupt flag CL = 0; //Reset PCA base timer CH = 0; CMOD = 0x08; //Set PCA timer clock source as Fosc/2 //Disable PCA timer overflow interrupt while(1) { ; } }
评论
    相关推荐
    • STC12C5A60S2 +LCD.zip
      STC12C5A60S2 MCU+LCD1602
    • STC12C5A60S2.zip
      该文档是51系列单片机的增强版,芯片有双串口,功能很强大
    • STC12C5A60S2AD_LCD
      STC12C5A60S2单片机 自带ADC实时采样,将数值显示在1602LCD上,并通过max518实时将显示电压转换输出。 工程建好,代码亲测,可直接下载运行。
    • STC12C5A60S2 单片机
      STC12C5A60S2 单片机 详细介绍,是读者很容易理解单片机原理
    • STC12C5A60s2 串口
      文件是STC12C5A60s2单片机串口实例,用了两个串口。说明STC12C5A60s2如何不占用定时器实现串口通信
    • stc12c5a60s2
      基于stc12c5a60s2单片机的ad模块和pca模块,先ad采样两路电压,若而这相加在规定范围内,则可由外设键盘输入占空比(lcd12864实时显示输入界面),以调节两路电压,若在规定范围外,lcd12864显示超过范围。
    • STC12C5A60S2例程
      20多个STC12的例程,TXT文档,,,,/*功能:点亮LED*/ ...#include<STC12C5A60S2.H> //添加STC12头文件 sbit LED=P2^2; //LED引脚定义 int main() //主函数 { LED=0; //置低电平,点亮LED灯 while(1); //while(1)循环 }
    • STC12C5A60S2.rar
      stc12c5a60s2的中文资料,官方版
    • STC12C5A60S2.rar
      STC12C5A60S2头文件 自己用的 STC12C5A60S2头文件 自己用的
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路