亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? scu_bs.lst

?? 時間觸發嵌入式系統設計模式源碼
?? LST
?? 第 1 頁 / 共 2 頁
字號:
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:04:06 PAGE 1   


C51 COMPILER V6.10, COMPILATION OF MODULE SCU_BS
OBJECT MODULE PLACED IN .\SCU_BS.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\SCU_BS.C OPTIMIZE(6,SIZE) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          /*------------------------------------------------------------------*-
   2          
   3             SCU_Bs.c (v1.00)
   4          
   5            ------------------------------------------------------------------
   6          
   7             This is an implementation of SCU SCHEDULER (RS-485) for 8051/52.
   8          
   9             --- See Chapter 27 ---
  10          
  11             *** SLAVE / BACKUP NODE ***
  12             *** MASTER CHECKS FOR SLAVE ACKNOWLEDEMENTS ***
  13             *** Includes support for tranceiver enables ***
  14          
  15             *** Uses 1232 watchdog timer ***
  16          
  17             *** Assumes 12 MHz osc (same as Master) ***
  18          
  19             *** Both Master and Slave share the same tick rate (5 ms) ***
  20             *** - See Master code for details ***
  21          
  22          
  23             COPYRIGHT
  24             ---------
  25          
  26             This code is from the book:
  27          
  28             PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont 
  29             [Pearson Education, 2001; ISBN: 0-201-33138-1].
  30          
  31             This code is copyright (c) 2001 by Michael J. Pont.
  32           
  33             See book for copyright details and other information.
  34          
  35          -*------------------------------------------------------------------*/
  36          
  37          #include "Main.h"
  38          #include "Port.h"
  39          
  40          #include "SCU_Bs.h"
  41          #include "TLight_B.h"
  42          
  43          // ------ Public variable definitions ------------------------------
  44          
  45          // Data sent from the master to this slave
  46          tByte Tick_message_data_G;
  47          
  48          // Data sent from this slave to the master 
  49          // - data may be sent on, by the master, to another slave  
  50          tByte Ack_message_data_G = '1'; 
  51          
  52          // ------ Public variable declarations -----------------------------
  53          
  54          // The array of tasks (see Sch51.c)
  55          extern sTask SCH_tasks_G[SCH_MAX_TASKS];
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:04:06 PAGE 2   

  56          
  57          // The error code variable (see Sch51.c)
  58          extern tByte Error_code_G;
  59          
  60          // ------ Private function prototypes ------------------------------
  61          
  62          static void  SCU_B_SLAVE_Enter_Safe_State(void);
  63          
  64          static void  SCU_B_SLAVE_Send_Ack_Message_To_Master(void);
  65          static tByte SCU_B_SLAVE_Process_Tick_Message(void);
  66          
  67          static void  SCU_B_SLAVE_Watchdog_Init(void);
  68          static void  SCU_B_SLAVE_Watchdog_Refresh(void) reentrant;
  69          
  70          
  71          // ------ Private constants ----------------------------------------
  72          
  73          // Each slave must have a unique non-zero ID 
  74          #define SLAVE_ID 0x31
  75          
  76          #define NO_NETWORK_ERROR (1) 
  77          #define NETWORK_ERROR (0)
  78          
  79          // ------ Private variables ----------------------------------------
  80          
  81          static bit Message_byte_G;
  82          static bit WATCHDOG_state_G = 0;
  83          static tByte Message_ID_G = 0;
  84          
  85          
  86          /*------------------------------------------------------------------*-
  87            SCU_B_SLAVE_Init_T1()
  88          
  89            Scheduler initialisation function.  Prepares scheduler
  90            data structures and sets up timer interrupts at required rate.
  91            Must call this function before using the scheduler.  
  92           
  93            BAUD_RATE - The required baud rate
  94          
  95          -*------------------------------------------------------------------*/
  96          void SCU_B_SLAVE_Init_T1(const tWord BAUD_RATE) 
  97             {
  98   1         tByte i;
  99   1      
 100   1         // Sort out the tasks
 101   1         for (i = 0; i < SCH_MAX_TASKS; i++) 
 102   1            {
 103   2            SCH_Delete_Task(i);
 104   2            }
 105   1      
 106   1         // Reset the global error variable
 107   1         // - SCH_Delete_Task() will generate an error code, 
 108   1         //   (because the task array is empty)
 109   1         Error_code_G = 0;
 110   1      
 111   1         // Set the network error pin (reset when tick message received)
 112   1         Network_error_pin = NETWORK_ERROR;
 113   1      
 114   1         // Set up RS-485 tranceiver
 115   1         RS485_Rx_NOT_Enable = 0;  // Receiver is (here) constantly enabled
 116   1                                   // (NOTE - negative logic!)
 117   1      
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:04:06 PAGE 3   

 118   1         RS485_Tx_Enable = 0;      // Transmitter (in slave) is enabled 
 119   1                                   // only when data are to be transmitted
 120   1                                   // by this slave
 121   1      
 122   1         // Ready for first tick message
 123   1         Message_byte_G = 1;
 124   1       
 125   1         // ------ Set the baud rate (begin) -----------------------------
 126   1         PCON &= 0x7F;   // Set SMOD bit to 0 (don't double baud rates)
 127   1      
 128   1         //  receiver enabled
 129   1         //  9-bit data, 1 start bit, 1 stop bit, variable baud rate (asynchronous)
 130   1         SCON = 0xD2;
 131   1      
 132   1         TMOD |= 0x20;   // T1 in mode 2, 8-bit auto reload
 133   1      
 134   1         TH1 = (256 - (tByte)((((tLong)OSC_FREQ / 100) * 3125) 
 135   1                  / ((tLong) BAUD_RATE * OSC_PER_INST * 1000)));
 136   1      
 137   1         TL1 = TH1;  
 138   1         TR1 = 1;  // Run the timer
 139   1         TI = 1;   // Send first character (dummy)
 140   1      
 141   1         // ------ Set the baud rate (end) -------------------------------
 142   1      
 143   1         // Interrupt enabled
 144   1         // (Both receiving and SENDING a byte will generate a serial interrupt)
 145   1         // Global interrupts not yet enabled.
 146   1         ES = 1;
 147   1      
 148   1         // Start the watchdog
 149   1         SCU_B_SLAVE_Watchdog_Init();  
 150   1         }
 151          
 152          /*------------------------------------------------------------------*-
 153            SCU_B_SLAVE_Start()
 154          
 155            Starts the slave scheduler, by enabling interrupts.
 156          
 157            NOTE: Usually called after all regular tasks are added,
 158            to keep the tasks synchronised.
 159          
 160            NOTE: ONLY THE SCHEDULER INTERRUPT SHOULD BE ENABLED!!! 
 161          
 162          -*------------------------------------------------------------------*/
 163          void SCU_B_SLAVE_Start(void) 
 164             {
 165   1         tByte Command = 0;
 166   1         tByte Message_byte;
 167   1         tByte Count = 0;
 168   1         bit Slave_started = 0;
 169   1      
 170   1         // Disable interrupts 
 171   1         EA = 0;
 172   1      
 173   1         // We can be at this point because:
 174   1         // 1. The network has just been powered up
 175   1         // 2. An error has occurred in the Master, and it is not generating ticks
 176   1         // 3. The network has been damaged and no ticks are being received by this slave
 177   1         //
 178   1         // Try to make sure the system is in a safe state...
 179   1         SCU_B_SLAVE_Enter_Safe_State();
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:04:06 PAGE 4   

 180   1      
 181   1         // NOTE: Interrupts are disabled here
 182   1         Count = 0;
 183   1      
 184   1         Error_code_G = ERROR_SCH_WAITING_FOR_START_COMMAND_FROM_MASTER;
 185   1         SCH_Report_Status(); // Sch not yet running - do this manually
 186   1      
 187   1         // Now wait (indefinitely) for appropriate signals from the master
 188   1         do {
 189   2            // Wait for tick messages (byte 1), all bits set to 0, to be received 
 190   2            do {
 191   3               SCU_B_SLAVE_Watchdog_Refresh(); // Must keep feeding the watchdog
 192   3               } while (RI == 0);  
 193   2      
 194   2            Message_byte = (tByte) SBUF; 
 195   2            RI = 0;
 196   2      
 197   2            // Must get two ID messages in a row...
 198   2            // (with command bit)
 199   2            // Ack each one
 200   2            if ((Message_byte == (tByte) SLAVE_ID) && (RB8 == 1))
 201   2               {
 202   3               Count++;
 203   3      
 204   3               // Received message for this slave - send ack
 205   3               // Must enable the slave RS-485 (Max489) hardware (Tx)
 206   3               RS485_Tx_Enable = 1;
 207   3      
 208   3               TI = 0;                                            
 209   3               TB8 = 1; // Set command bit
 210   3               SBUF = (tByte) SLAVE_ID; 
 211   3      
 212   3               // Wait while data are sent
 213   3               // (watchdog will trap UART failure...)
 214   3               while (TI == 0);
 215   3      
 216   3               // Now clear Tx enable pin
 217   3               RS485_Tx_Enable = 0;
 218   3               }
 219   2            else
 220   2               {
 221   3               Count = 0;
 222   3               }
 223   2            } while (Count < 2);
 224   1      
 225   1         // Start the scheduler
 226   1         EA = 1;
 227   1         }
 228          
 229          /*------------------------------------------------------------------*-
 230          
 231            SCU_B_SLAVE_Update
 232          
 233            This is the scheduler ISR.  It is called at a rate 
 234            determined by the timer settings in SCU_B_SLAVE_Init().
 235          
 236            This Slave is triggered by USART interrupts.
 237           
 238          -*------------------------------------------------------------------*/
 239          void SCU_B_SLAVE_Update(void) interrupt INTERRUPT_UART_Rx_Tx  
 240             {
 241   1         tByte Index;
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:04:06 PAGE 5   

 242   1      
 243   1         if (RI == 1) // Must check this. 
 244   1            {
 245   2            // Default
 246   2            Network_error_pin = NO_NETWORK_ERROR;
 247   2      
 248   2            // Two-byte messages are sent (Ack) and received (Tick)
 249   2            // - it takes two sched ticks to process each message
 250   2            //
 251   2            // Keep track of the current byte
 252   2            if (Message_byte_G == 0)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天综合色天天综合| 成人免费高清视频| 一区二区三区中文在线观看| 日韩美女一区二区三区四区| 日韩一区二区三区免费观看| 日韩一级成人av| 日韩你懂的在线观看| 欧美一区二区三区在线观看| 91精品国产欧美一区二区成人| 欧美午夜精品一区二区三区| 欧美影院午夜播放| 日韩一区二区在线看| 亚洲精品一线二线三线| 久久久精品一品道一区| 日本一区二区在线不卡| 国产精品人妖ts系列视频| 中文字幕一区二区三| 亚洲天堂精品视频| 日韩精品五月天| 国产一区日韩二区欧美三区| 另类小说色综合网站| 国产成人精品午夜视频免费| 99久久综合狠狠综合久久| 欧美三级日韩在线| 久久久综合视频| 亚洲激情综合网| 蜜桃视频第一区免费观看| 国产精品亚洲成人| 色美美综合视频| 51精品视频一区二区三区| 久久影院午夜片一区| 欧美国产一区在线| 亚洲午夜免费视频| 激情欧美日韩一区二区| 色综合久久久久综合体桃花网| 91精品国产色综合久久不卡蜜臀| 日韩欧美高清一区| 亚洲三级理论片| 毛片一区二区三区| 91麻豆成人久久精品二区三区| 91麻豆精品久久久久蜜臀| 中文字幕巨乱亚洲| 亚洲成人免费视| 国产成人免费9x9x人网站视频| 97超碰欧美中文字幕| 欧美亚洲愉拍一区二区| 欧美激情中文不卡| 偷拍与自拍一区| 日本韩国一区二区| 中文字幕久久午夜不卡| 美女网站色91| 欧美日韩国产一级片| 1024成人网| 国产综合色视频| 欧美色图12p| 综合在线观看色| 国产风韵犹存在线视精品| 制服丝袜激情欧洲亚洲| 亚洲一区二区三区国产| 99免费精品在线观看| 国产三级三级三级精品8ⅰ区| 日本免费新一区视频| 欧美午夜精品一区二区三区| 中文字幕日韩一区二区| 粉嫩aⅴ一区二区三区四区| 日韩欧美黄色影院| 日本不卡免费在线视频| 欧美日韩在线播放三区四区| 一区二区三区中文字幕| 91影院在线观看| 日本少妇一区二区| 欧美日韩激情一区二区| 久久久久久夜精品精品免费| 精品国产91亚洲一区二区三区婷婷| 久久久99精品免费观看不卡| 久久精品免费观看| 欧美日韩亚洲综合| 亚洲午夜电影网| 亚洲成人久久影院| 欧美日韩在线一区二区| 污片在线观看一区二区| 欧美亚洲另类激情小说| 午夜视频在线观看一区二区三区| 91极品视觉盛宴| 午夜欧美在线一二页| 欧美日韩久久不卡| 日韩二区三区四区| 久久综合色之久久综合| 国产精品456| ●精品国产综合乱码久久久久| 精品亚洲成av人在线观看| 国产欧美日韩综合| 99视频超级精品| 亚洲成av人片在www色猫咪| 日韩欧美美女一区二区三区| 免费成人美女在线观看| 欧美国产精品一区| 色婷婷精品久久二区二区蜜臂av| 午夜国产不卡在线观看视频| 日韩情涩欧美日韩视频| 美女脱光内衣内裤视频久久网站| 精品久久一区二区| 色综合天天视频在线观看 | 亚洲国产成人在线| 不卡的电影网站| 亚洲一区二区三区国产| 26uuu国产电影一区二区| 国产精品自拍网站| 亚洲国产日韩一区二区| 欧美成人精品福利| 色综合中文字幕| 美女一区二区在线观看| 1区2区3区欧美| 91麻豆精品国产91| 99这里只有精品| 性欧美大战久久久久久久久| 欧美激情中文字幕| 91精品国产综合久久香蕉麻豆| 国产91精品入口| 青椒成人免费视频| 亚洲综合偷拍欧美一区色| 久久久久久**毛片大全| 欧美日韩久久一区二区| 99久久精品免费| 国产精一区二区三区| 三级在线观看一区二区| 国产精品第五页| 久久网站最新地址| 欧美精品高清视频| 欧美天堂一区二区三区| www.久久久久久久久| 国产在线精品国自产拍免费| 水野朝阳av一区二区三区| 中文av一区特黄| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美日韩高清不卡| 91蝌蚪porny九色| 盗摄精品av一区二区三区| 激情六月婷婷综合| 日本va欧美va精品发布| 五月综合激情网| 亚洲自拍偷拍av| 亚洲欧洲日产国码二区| 欧美国产综合色视频| 国产亚洲成aⅴ人片在线观看 | 亚洲男人都懂的| 欧美国产精品久久| 国产欧美一区二区三区网站| 欧美videos大乳护士334| 7777精品伊人久久久大香线蕉经典版下载| 成人免费视频视频| aaa欧美大片| 91香蕉国产在线观看软件| 99久久精品免费精品国产| 欧美激情一区二区三区| 成人精品国产一区二区4080| 亚洲一区在线观看视频| 亚洲国产精品一区二区尤物区| 国产精品传媒入口麻豆| 日韩欧美国产电影| 欧美日韩在线免费视频| 97久久久精品综合88久久| 欧美日韩激情一区二区三区| 国内精品久久久久影院一蜜桃| 蜜桃视频在线一区| 欧美一区三区四区| 日韩欧美国产综合| 欧美日韩国产一级片| 成人听书哪个软件好| 国产精品久久久久久妇女6080| 欧美高清激情brazzers| 狠狠色综合日日| 国产成人精品影院| 成人av在线资源网站| 亚洲一区二区三区中文字幕在线 | 亚洲天堂精品视频| 91香蕉视频在线| 五月天激情小说综合| 手机精品视频在线观看| 不卡av在线网| 欧美精品vⅰdeose4hd| 久久久精品影视| 日韩精品一级中文字幕精品视频免费观看 | 久久欧美一区二区| 在线播放国产精品二区一二区四区| 欧美亚洲丝袜传媒另类| 中文一区一区三区高中清不卡| 美女一区二区视频| 精品亚洲成a人| 欧美一区日韩一区| 韩国一区二区在线观看| av在线综合网| 久久综合给合久久狠狠狠97色69| 毛片av一区二区| 日韩亚洲欧美高清| 国产成人av一区| 亚洲福中文字幕伊人影院| 欧美日韩美少妇| 中文字幕永久在线不卡| 久久99精品久久久久久久久久久久|