<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > PIC單片機模擬開關(guān)程序

          PIC單片機模擬開關(guān)程序

          作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏
          程序介紹:簡單的按鍵按下,相應(yīng)的燈亮,按鍵彈起,燈滅。只有一個按鍵哦,相應(yīng)的也只是一個燈亮。


          本文引用地址:http://www.ex-cimer.com/article/201611/323993.htm
          #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
          #endif
          #ifdef HI_TECH_C
          #include
          #endif
          //Configurationdata
          //Internal functions
          #include "F:Program FilesMatrix MultimediaFlowcode V4FCDinternals.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: A0 -> count
          trisa = trisa | 0x01;
          FCV_COUNT = ((porta & 0x01) == 0x01);

          //Decision
          //Decision: count=1?
          if (FCV_COUNT==1)
          {
          //Output
          //Output: count -> C0
          trisc = trisc & 0xfe;
          if (FCV_COUNT)
          portc = (portc & 0xfe) | 0x01;
          else
          portc = portc & 0xfe;

          } else {
          //Input
          //Input: PORT A -> count
          trisa = trisa | 0xff;
          FCV_COUNT = porta;

          //Output
          //Output: count -> PORT C
          trisc = 0x00;
          portc = FCV_COUNT;

          }

          }

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


          關(guān)鍵詞: PIC單片機模擬開

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();