欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機(jī)教程網(wǎng) >> MCU設(shè)計實例 >> 瀏覽文章

PIC單片機(jī)多路開關(guān)程序

作者:佚名   來源:本站原創(chuàng)   點擊數(shù):  更新時間:2013年11月12日   【字體:

程序介紹:使用同一個IO口進(jìn)行設(shè)置,高字節(jié)為按鍵,低字節(jié)為燈,流程中嵌入關(guān)系式變化:
 FCV_COUNT = FCV_COUNT>>4;
FCV_COUNT = FCV_COUNT & 0x0f;

//**  Date:          Wednesday, November 21, 2012 20:50:00
//本程序版權(quán)所有: 51hei.com
#define MX_PIC
//Defines for microcontroller
#define P16F690
#define MX_EE
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_BCB
#define MX_SPI_SDI 4
#define MX_SPI_SDO 7
#define MX_SPI_SCK 6
#define MX_UART
#define MX_UART_B
#define MX_UART_TX 7
#define MX_UART_RX 5
#define MX_I2C
#define MX_MI2C
#define MX_I2C_B
#define MX_I2C_SDA 4
#define MX_I2C_SCL 6
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 5

//Functions
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include <system.h>
#endif
#ifdef HI_TECH_C
#include <pic.h>
#endif
//Configuration data
//Internal functions
#include "F:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"
//Macro function declarations

//Variable declarations
char FCV_COUNT;
 
//Macro implementations
void main()
{
 
 //Initialisation
 ansel = 0;
anselh = 0;

 //Interrupt initialisation code
 option_reg = 0xC0;

 //Loop
 //Loop: While 1
 while (1)
 {
  //Input
  //Input: PORT C -> count
  trisc = trisc | 0xff;
  FCV_COUNT = portc;

  //Calculation
  //Calculation:
  //  count = count>>4
  //  count = count AND 0x0f
  FCV_COUNT = FCV_COUNT>>4;
  FCV_COUNT = FCV_COUNT & 0x0f;
  
  //Output
  //Output: count -> PORT C
  trisc = 0x00;
  portc = FCV_COUNT;

 }

 mainendloop: goto mainendloop;
}
void MX_INTERRUPT_MACRO(void)
{
}

關(guān)閉窗口

相關(guān)文章