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

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

?? scu_bs.lst

?? 時間觸發嵌入式系統設計模式源碼
?? LST
?? 第 1 頁 / 共 2 頁
字號:
C51 COMPILER V6.10  SCU_BS                                                                 04/19/2001 14:00:19 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 = '2'; 
  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:00:19 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 0x32
  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:00:19 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:00:19 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:00:19 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一区二区三区免费野_久草精品视频
国产一区二区视频在线| 欧美日韩久久一区| 欧洲精品在线观看| 久久美女高清视频| 日韩不卡一区二区| 一本色道久久综合精品竹菊 | 日日夜夜一区二区| 99久久精品免费| 精品国产乱码久久久久久蜜臀| 亚洲夂夂婷婷色拍ww47| 豆国产96在线|亚洲| 精品国产乱码久久久久久1区2区| 亚洲高清视频在线| 色呦呦国产精品| 国产精品麻豆网站| 国产一区二区福利视频| 日韩小视频在线观看专区| 亚洲精品国产视频| 91美女在线观看| 亚洲欧美一区二区视频| 国产成人精品aa毛片| 精品国产乱码久久久久久老虎| 日韩国产欧美在线播放| 欧美性猛交xxxxxxxx| 伊人色综合久久天天| 色素色在线综合| 尤物视频一区二区| 91激情五月电影| 亚洲国产欧美一区二区三区丁香婷| 色综合久久久久| 最新国产成人在线观看| 99久久久久久| 一区二区三区加勒比av| 在线精品视频免费观看| 综合久久综合久久| 色综合天天综合给合国产| 亚洲欧洲无码一区二区三区| 成人97人人超碰人人99| 亚洲婷婷综合色高清在线| 色综合久久88色综合天天| 亚洲国产精品尤物yw在线观看| 欧美最新大片在线看| 日韩电影免费在线看| 精品日韩一区二区| 丁香亚洲综合激情啪啪综合| 国产精品无码永久免费888| 91社区在线播放| 午夜精品久久久久久久久久久| 777午夜精品视频在线播放| 免费观看30秒视频久久| 国产欧美一区二区在线观看| 91丨porny丨蝌蚪视频| 亚洲激情综合网| 欧美一区二区三区成人| 国产成人在线观看| 亚洲在线中文字幕| 欧美大片在线观看| 99精品欧美一区二区蜜桃免费 | 极品少妇一区二区三区精品视频 | 精品国产乱码久久久久久久久 | av电影天堂一区二区在线| 亚洲人成网站在线| 欧美一区永久视频免费观看| 国产精品一区二区91| 亚洲欧美日韩成人高清在线一区| 欧美精品777| 国产乱码精品一区二区三区忘忧草 | 亚洲日本在线视频观看| 欧美日韩国产免费一区二区 | 欧美调教femdomvk| 国内精品自线一区二区三区视频| 国产精品电影一区二区三区| 欧美三级日韩三级| 国产精品911| 午夜激情综合网| 国产女主播视频一区二区| 欧美男女性生活在线直播观看| 国产福利一区在线| 日本最新不卡在线| 亚洲欧美韩国综合色| 亚洲精品一区二区三区精华液| 91丨porny丨最新| 国产一区二区三区四区五区美女| 亚洲va在线va天堂| 亚洲天堂a在线| 久久精品男人天堂av| 日韩午夜激情av| 欧美性猛片xxxx免费看久爱| 风间由美一区二区av101| 日韩成人精品在线观看| 亚洲一区二区在线免费看| 国产女人18毛片水真多成人如厕 | 一区二区三区中文字幕电影| 久久综合色播五月| 欧美日韩久久一区| 一本大道综合伊人精品热热| 成人伦理片在线| 国产精品中文字幕欧美| 久久99精品久久久久久久久久久久 | 欧美日韩另类一区| 91国偷自产一区二区三区成为亚洲经典 | 成人av片在线观看| 国产精品影视网| 国产在线精品视频| 久久99精品视频| 久久综合综合久久综合| 男男gaygay亚洲| 丝袜美腿成人在线| 日韩国产欧美在线播放| 午夜激情一区二区| 日韩av一区二区三区四区| 天天色 色综合| 午夜精品久久久久久久99水蜜桃| 亚洲不卡在线观看| 五月婷婷另类国产| 视频在线观看一区二区三区| 亚洲国产一区二区三区| 亚洲成人精品影院| 亚洲6080在线| 美国三级日本三级久久99| 蜜桃精品视频在线| 狠狠色丁香婷婷综合久久片| 国产精品伊人色| 99精品热视频| 欧美日韩一区二区电影| 欧美精品xxxxbbbb| 欧美精品一区二区三| 国产偷国产偷精品高清尤物| 中文字幕在线不卡一区二区三区| 日韩伦理免费电影| 亚洲aⅴ怡春院| 精品在线播放免费| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 久久av中文字幕片| 国产不卡在线视频| 91成人免费在线| 欧美精品 国产精品| 精品日韩一区二区三区免费视频| 国产欧美一区二区三区鸳鸯浴| 日韩毛片一二三区| 日本伊人色综合网| 岛国av在线一区| 欧洲色大大久久| 2021国产精品久久精品| 综合久久国产九一剧情麻豆| 丝袜美腿亚洲综合| 国产99久久久国产精品潘金| 91国偷自产一区二区使用方法| 日韩一区二区免费在线电影| 日本一区二区免费在线| 樱桃视频在线观看一区| 精品在线播放免费| 色呦呦国产精品| 久久日韩粉嫩一区二区三区 | 亚洲欧洲一区二区三区| 视频一区在线视频| 欧美电影免费提供在线观看| 国产亚洲婷婷免费| 亚洲国产一区二区在线播放| 国产成人超碰人人澡人人澡| 欧美日韩中文字幕精品| 欧美国产精品久久| 日韩av电影天堂| 91看片淫黄大片一级在线观看| 日韩欧美美女一区二区三区| 亚洲视频免费看| 国产精品自在在线| 日韩一区二区三区免费观看| 亚洲精品高清视频在线观看| 丁香亚洲综合激情啪啪综合| 日韩一区二区精品葵司在线| 一区二区三区视频在线观看| 成人性生交大片免费看中文网站| 欧美精三区欧美精三区| 亚洲最色的网站| av亚洲精华国产精华| 久久久久久久综合狠狠综合| 欧美96一区二区免费视频| 91福利精品第一导航| 综合久久久久久| 成人黄色综合网站| 国产欧美日韩视频在线观看| 精品一区在线看| 精品免费一区二区三区| 日韩va欧美va亚洲va久久| 欧美日韩国产另类一区| 亚洲亚洲人成综合网络| 日本高清无吗v一区| 成人欧美一区二区三区小说 | 美脚の诱脚舐め脚责91 | 精品一区二区三区在线播放| 欧美日本高清视频在线观看| 一区二区三区中文字幕电影| 色偷偷一区二区三区| 综合激情成人伊人| 91福利区一区二区三区| 一级精品视频在线观看宜春院 | 色综合天天做天天爱| 亚洲人成在线播放网站岛国| 日本道免费精品一区二区三区|