研读手册
PDIP40没有
- /*------------------------------------------------------------------*/
- /* --- STC MCU Limited ---------------------------------------------*/
- /* --- STC12C5Axx Series MCU IO Demo -------------------------------*/
- /* --- Mobile: (86)13922805190 -------------------------------------*/
- /* --- Fax: 86-0513-55012956,55012947,55012969 ---------------------*/
- /* --- Tel: 86-0513-55012928,55012929,55012966----------------------*/
- /* 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"
- sfr P4 = 0xC0;
- sbit P40 = P4^0;
- sbit P41 = P4^1;
- sbit P42 = P4^2;
- sbit P43 = P4^3;
- sfr P4SW = 0xBB; // - LVD_P4.6 ALE_P4.5 NA_P4.4 - - - -
- void delay()
- {
- int i, j;
- for (i=0; i<1000; i++)
- for (j=0; j<500; j++);
- }
- void main()
- {
- P4SW = 0x70;
- P40 = 0;
- delay();
- P40 = 1;
- P41 = 0;
- delay();
- P41 = 1;
- P42 = 0;
- delay();
- P42 = 1;
- P43 = 0;
- delay();
- P43 = 1;
- while (1)
- {
- P4 = 0x00;
- delay();
- P4 = 0xff;
- }
- }
复制代码
|