久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3207|回復: 0
收起左側

一個PortSwitch程序串口緩存處理的比較不錯

[復制鏈接]
ID:82781 發表于 2015-6-13 01:14 | 顯示全部樓層 |閱讀模式
  1. // Simple port switching controller
  2. // A very light weight comms suite and command interpreter is implemented.
  3. // Literal strings are used in-line - usually not an efficient practice.
  4. //

  5. #define NULL 0
  6. #define FALSE 0
  7. #define TRUE  1

  8. // Buffer lengths are short to prevent the need for external RAM
  9. // Only idata is used.
  10. #define TX_BUFFER_LENGTH 16
  11. #define RX_BUFFER_LENGTH 16

  12. #define RX_CMD_TERMINATOR 0x0D  // <CR>
  13. #define RX_CMD_BACKSPACE  0x08  // <CR>

  14. #define NUMBER_OF_PORTS 4

  15. #define CLK_FREQ     3U*11059200UL // about 33.178 MHz
  16. #define BAUD_RATE    57600UL


  17. // Save ram space by keeping all strings in ROM if
  18. // possible
  19. #pragma romstring

  20. // Globals - resource limited processor and simple
  21. // demonstration program. Globals are being used.

  22. // version string
  23. __rom char sVersion[] = "PrtSw Ver 1.3 ";
  24. __rom char sDate[] = __DATE__" ";  // Date with appended space
  25. __rom char sTime[] = __TIME__;

  26. // RS-232 receive buffers
  27. // These buffers are quite restricted in length and so
  28. // overflow will have to be managed (it has to be managed
  29. // regardless of length, but in this instance we will
  30. // no doubt have plenty of instances of overflow).
  31. // In the first instance overflow shall be managed by
  32. // discarding characters up until the next command
  33. // terminator (v. simple).
  34. // Two buffers are provided to allow for ping-ponging
  35. // between them as one is being dealt with at the the
  36. // higher level and one is receiving characters from
  37. // the receive ISR.
  38. char rxBuffer1[RX_BUFFER_LENGTH];
  39. char rxBuffer2[RX_BUFFER_LENGTH];
  40. unsigned char rxBuffer1Length = 0;
  41. unsigned char rxBuffer2Length = 0;

  42. __bit rxBuffer1Ready = FALSE;
  43. __bit rxBuffer2Ready = FALSE;

  44. // RS-232 transmit buffers
  45. // Very limited in length to conserve
  46. // RAM space.  Note that ROM-based
  47. // messages can be longer.
  48. char txBuffer[TX_BUFFER_LENGTH];
  49. unsigned char txBufferLength = 0;


  50. // ISR variables
  51. const char *isrTXBuf;
  52. __rom char *isrTXBufROM;   
  53.                       // Code space is more available than RAM
  54.                       // so I use a separate pointer to dump
  55.                       // ROM-based messages. Rather than copying
  56.                       // the ROM messages into a RAM buffer.
  57. unsigned char isrTXLength;
  58. unsigned char isrTXIndex;
  59. __bit isrTXFromRom;   // TRUE if transmitting a ROM-based message
  60. char *isrRXBuf;
  61. unsigned char isrRXLength;
  62. __bit isrUsingRXBuffer1;


  63. // ROM-based messaged - see also Version variables at the top
  64. __rom const char txBufferPrompt[] = "cmd>";
  65. #define PROMPT_LENGTH sizeof(txBufferPrompt)/sizeof(char)-1
  66. __rom const char txBufferCR = 0x0d;

  67. // Shadow registers
  68. // Some of the I/O ports require shadow registers for correct operation
  69. // as not all the pins are the same direction and the port out and
  70. // in busses are not hardwired together.
  71. // This demonstrates a possible difference between an embedded 8051
  72. // and a traditional chip.
  73. unsigned char P1_ShadowReg;


  74. // Forward declarations of function prototypes
  75. void ClearBuffer(char *cmdBuffer);
  76. _Bool DoCommand(const char *cmdBuffer); // Simple command interpreter
  77. void PrintHelp(void);                   // Print simple help
  78. void PrintPrompt(void);                 // Print a small prompt
  79. void PrintVersion(void);
  80. _Bool Transmit(const char *msg, const unsigned char length);
  81. _Bool TransmitRomMsg(__rom char * msg, unsigned char length);
  82. _Bool TransmitCR(void);
  83. _Bool TransmitPrompt(void);

  84. void Init(void);
  85. void SetupSerialPort(void);

  86. _Bool Connect(unsigned char destPort, unsigned char srcPort);
  87. _Bool SetPortState(unsigned char port, _Bool enable);
  88. _Bool GetPortState(unsigned char port);
  89. _Bool QueryPort(unsigned char port);
  90. _Bool DumpPort(unsigned char port);
  91. signed char QueryConnection(unsigned char port);
  92. unsigned char ConvertPortToIndex(unsigned char port);


  93. void delay(void)
  94. {
  95.     int i;
  96.     for(i=0; i<0x1fff; i++)
  97.     {
  98.     }
  99. }


  100. void main(void)
  101. {
  102.     Init();
  103.     SetupSerialPort();
  104.    
  105.     TransmitCR();
  106.     PrintVersion();
  107.     TransmitCR();
  108.     TransmitPrompt();
  109.     ClearBuffer(rxBuffer1);
  110.     ClearBuffer(rxBuffer2);

  111.     while(1)
  112.     {
  113.       
  114.        // Simple Task Manager
  115.        // Loop forever and check status of
  116.        // signals from low level software.
  117.        // Trigger high level tasks as required.

  118.        if(rxBuffer1Ready)
  119.        {
  120.           DoCommand(rxBuffer1);
  121.           ClearBuffer(rxBuffer1);
  122.           rxBuffer1Ready = FALSE;  // allow ISR to use this buffer if it wishes
  123.        }
  124.        if(rxBuffer2Ready)
  125.        {
  126.           DoCommand(rxBuffer2);
  127.           ClearBuffer(rxBuffer2);
  128.           rxBuffer2Ready = FALSE;  // allow ISR to use this buffer if it wishes
  129.        }
  130.     }
  131. }

  132. void ClearBuffer(char *cmdBuffer)
  133. {
  134.     for(int i=0; i < RX_BUFFER_LENGTH; i++)
  135.     {
  136.         cmdBuffer[i] = 0x00;
  137.     }
  138. }

  139. // DoCommand is the (simple) command interpreter.
  140. // Command decoding and execution.
  141. // Assumes fixed format commands - each command handler
  142. // does its own parameter checking (though there is very
  143. // limited error handling).
  144. _Bool DoCommand(const char *cmdBuffer)
  145. {
  146.     _Bool bRetVal = FALSE;
  147.     unsigned char i;
  148.     unsigned char ch1, ch2;

  149.     if(cmdBuffer != NULL)
  150.     {
  151.        TransmitCR();
  152.        switch(cmdBuffer[0])
  153.        {
  154.           case '?':
  155.           case 'h':
  156.           case 'H':
  157.              // Dump help
  158.              PrintHelp();
  159.              bRetVal = TRUE;
  160.              break;

  161.           case 'v':
  162.           case 'V':
  163.              // Dump version
  164.              PrintVersion();
  165.              bRetVal = TRUE;
  166.              break;

  167.           case 'e':
  168.           case 'E':
  169.              // port enable/disable command
  170.              // we expect an integer (port)
  171.              // followed by another integer (1 or 0)
  172.              // Subtract '1' from port to get zero based port.
  173.              // Subtract '0' from integer to get 0 for '0' and 1 for '1'.
  174.              // No error checking for now
  175.              ch1 = ConvertPortToIndex(cmdBuffer[2]);
  176.              if( ch1 == 0xff)
  177.              {
  178.                 // Parameter error
  179.                 TransmitRomMsg("Invalid port", 12);
  180.              }
  181.              else
  182.              {
  183.                  if( SetPortState( ch1, (cmdBuffer[4])-'0'))
  184.                  {
  185.                     TransmitRomMsg("OK", 2);
  186.                  }
  187.                  else
  188.                  {
  189.                     TransmitRomMsg("Fail", 4);
  190.                  }
  191.              }
  192.              bRetVal = TRUE;
  193.              break;


  194.           case 'm':
  195.           case 'M':
  196.              // port mapping command
  197.              // we expect an integer
  198.              // followed by another integer
  199.              // No error checking for now
  200.              // See if we have alpha or numeric port references
  201.              // Also deal with upper and lower case
  202.              ch1 = ConvertPortToIndex(cmdBuffer[2]);
  203.              ch2 = ConvertPortToIndex(cmdBuffer[4]);
  204.              if( ch1 == 0xff)
  205.              {
  206.                 // Parameter error
  207.                 TransmitRomMsg("Invalid destination port", 24);
  208.              }
  209.              if( ch2 == 0xff)
  210.              {
  211.                  if( ch1 == 0xff)
  212.                  {
  213.                     // add in <CR> if we have already printed an error message
  214.                     TransmitCR();
  215.                  }
  216.                 // Parameter error
  217.                 TransmitRomMsg("Invalid source port", 19);
  218.              }

  219.              if((ch1 != 0xff) && (ch2 != 0xff))
  220.              {
  221.                  if( Connect(ch1, ch2))
  222.                  {
  223.                     TransmitRomMsg("OK", 2);
  224.                  }
  225.                  else
  226.                  {
  227.                     TransmitRomMsg("Fail", 4);
  228.                  }
  229.              }
  230.              bRetVal = TRUE;
  231.              break;

  232.           case 'q':
  233.           case 'Q':
  234.              // Query port mapping and enable state
  235.              // We expect an integer giving the port to query
  236.              ch1 = ConvertPortToIndex(cmdBuffer[2]);
  237.              if( ch1 == 0xff)
  238.              {
  239.                 // Parameter error
  240.                 TransmitRomMsg("Invalid port", 12);
  241.              }
  242.              else if( !DumpPort(ch1))
  243.              {
  244.                 TransmitRomMsg("Fail", 4);
  245.              }
  246.              bRetVal = TRUE;
  247.              break;

  248.           case 'd':
  249.           case 'D':
  250.              // Query port mapping and enable state for all ports
  251.              for(i=0; i<NUMBER_OF_PORTS; i++)
  252.              {
  253.                 if( !DumpPort(i))
  254.                 {
  255.                    TransmitRomMsg("Fail", 4);
  256.                 }
  257.                 TransmitCR();
  258.              }
  259.              bRetVal = TRUE;
  260.              break;

  261.           default:
  262.              TransmitRomMsg("Huh?", 4);
  263.              break;
  264.        }
  265.        TransmitCR();
  266.        TransmitPrompt();
  267.     }
  268.     return bRetVal;
  269. }

  270. unsigned char ConvertPortToIndex(unsigned char port)
  271. {
  272.     unsigned char index = port;
  273.     if( (port >= '1') && (port <= '4'))
  274.     {
  275.         index -= '1';
  276.     }
  277.     else if( (port >= 'a') && (port <= 'd'))
  278.     {
  279.         index -= 'a';
  280.     }
  281.     else if( (port >= 'A') && (port <= 'D'))
  282.     {
  283.         index -= 'A';
  284.     }
  285.     else
  286.     {
  287.         index = 0xff;  // signal error
  288.     }

  289.     return index;
  290. }

  291. void PrintVersion(void)
  292. {
  293.     // Dump the version number and date and time.
  294.     // will have to wait around for the dump to occur
  295.     // as our buffers are too small to take the
  296.     // full dump in one go.
  297.     //
  298.     // This code is not all that robust.  If there is a
  299.     // problem transmitting one part of the
  300.     // message the rest will still be attempted - this
  301.     // is probably not what is required.
  302.     // Also, the wait for the TX system is infinite.
  303.     // This should be a timed wait with error
  304.     // recovery.
  305.     TransmitRomMsg(sVersion, sizeof(sVersion)/sizeof(char)-1);
  306.     TransmitRomMsg(sDate,    sizeof(sDate)/sizeof(char)-1);
  307.     TransmitRomMsg(sTime,    sizeof(sTime)/sizeof(char)-1);
  308. }


  309. void PrintHelp(void)
  310. {
  311.     // Dump the help
  312.     //
  313.     // This code is not all that robust.  If there is a
  314.     // problem transmitting one part of the
  315.     // message the rest will still be attempted - this
  316.     // is probably not what is required.
  317.     // Also, the wait for the TX system is infinite.
  318.     // This should be a timed wait with error
  319.     // recovery.
  320.     TransmitRomMsg("v         - print version", 25); TransmitCR();
  321.     TransmitRomMsg("? or h    - print help", 22); TransmitCR();
  322.     TransmitRomMsg("e prt 1|0 - enable/disable prt (1=enable)", 41); TransmitCR();
  323.     TransmitRomMsg("m dst src - drive dst outputs from src inputs", 45); TransmitCR();
  324.     TransmitRomMsg("q prt     - query prt connection and state" , 42); TransmitCR();
  325.     TransmitRomMsg("d         - dump all port connections and states", 48); TransmitCR();
  326. }


  327. _Bool TransmitCR(void)
  328. {
  329.     return TransmitRomMsg(&txBufferCR, 1);
  330. }

  331. _Bool TransmitPrompt(void)
  332. {
  333.     return TransmitRomMsg(txBufferPrompt, PROMPT_LENGTH);
  334. }

  335. _Bool Transmit(const char * msg, unsigned char length)
  336. {
  337.     // This is a blocking function - it will
  338.     // wait indefinitely until the serial port
  339.     // is free.  Not ideal but simple for now.
  340.    
  341.     _Bool bRetVal = TRUE;

  342.     // The following access of the isrTXLength variable
  343.     // is atomic (byte variable) so we do not need to
  344.     // disable interrupts.
  345.     while(isrTXLength != 0)
  346.     {
  347.        // Wait until the port is free.
  348.        // We could put a timeout in here and return FALSE if
  349.        // the TX fails.      
  350.     }
  351.     isrTXBuf = msg; // not sure this will work on a ROM string?
  352.     isrTXLength = length;
  353.     isrTXIndex = 1;  // we will send the 0'th character below
  354.     isrTXFromRom = FALSE;

  355.     SBUF = msg[0];  // start the transmission
  356.       
  357.    
  358.     return bRetVal;
  359. }

  360. _Bool TransmitRomMsg(__rom char * msg, unsigned char length)
  361. {
  362.     // This is a blocking function - it will
  363.     // wait indefinitely until the serial port
  364.     // is free.  Not ideal but simple for now.
  365.    
  366.     _Bool bRetVal = TRUE;
  367.    
  368.     // The following access of the isrTXLength variable
  369.     // is atomic (byte variable) so we do not need to
  370.     // disable interrupts.
  371.     while(isrTXLength != 0)
  372.     {
  373.        // Wait until the port is free.
  374.        // We could put a timeout in here and return FALSE if
  375.        // the TX fails.
  376.     }
  377.     isrTXBufROM = msg; // not sure this will work on a ROM string?
  378.     isrTXLength = length;
  379.     isrTXIndex = 1;  // we will send the 0'th character below
  380.     isrTXFromRom = TRUE;

  381.     SBUF = msg[0];  // start the transmission
  382.       
  383.     return bRetVal;
  384. }


  385. void Init(void)
  386. {
  387.        // Initialise ports for loopback and disabled
  388.        unsigned char i;
  389.        for(i=0; i<NUMBER_OF_PORTS; i++)
  390.        {
  391.           SetPortState(i, FALSE);
  392.           Connect(i, i);
  393.        }
  394. }

  395. void SetupSerialPort(void)
  396. {
  397.     isrTXBuf = NULL;
  398.     isrTXLength = 0;
  399.     isrRXBuf = rxBuffer1;
  400.     isrRXLength = 0;
  401.     isrUsingRXBuffer1 = TRUE;

  402.     SM0 = 0;   
  403.     SM1 = 1;    // Mode 1 - 8-bit UART
  404.     SM2 = 0;    // Disable multiprocessor feature
  405.     TB8 = 0;    // 9th bit (not used)
  406.     RB8 = 0;    // This is the rx stop bit.
  407.     TI  = 0;    // Clr TX int
  408.     RI  = 0;    // Clr RX int
  409.    
  410.     //Need to set up timer 1 for baud rate CLK_FREQ_MHZ
  411.    
  412.     TR1 = 0; // stop timer 1
  413.    
  414.     PCON_bit(7) = 1;  // SMOD = 1 -> high speed baud rate
  415.   
  416.     // baud rate divisor
  417.     TL1 = 0;  // initialise to zero
  418.     TH1 = 256U - (2 * CLK_FREQ/(12U*32U*BAUD_RATE));
  419.    
  420.     TMOD_bit(7) = 0;    // disable GATE
  421.     TMOD_bit(6) = 0;    // operate as timer
  422.     TMOD_bit(5) = 1;
  423.     TMOD_bit(4) = 0;    // 8-bit timer auto-reload mode

  424.     IT0 = 0;  
  425.     IE0 = 0;
  426.     IT1 = 0;
  427.     IE1 = 0;
  428.     TR0 = 0; // timer 0 stopped
  429.     TF0 = 0;
  430.     TR1 = 1; // timer 1 running
  431.     TF1 = 0;  
  432.    
  433.     ES = 1;
  434.     IE_bit(7) = 1;

  435.     REN = 1;  // enable reception
  436. }

  437. // Connect - the destination port outputs are driven from the
  438. //           the inputs of the source port.
  439. //           __putbit and __getbit could be used in this function.
  440. //           Returns TRUE if both ports are within range, FALSE
  441. //           otherwise (and no mapping change is done in this case).

  442. _Bool Connect(unsigned char destPort, unsigned char srcPort)
  443. {
  444.     _Bool bRetVal;
  445.     // Are ports within range?
  446.     if(destPort >= NUMBER_OF_PORTS || srcPort >= NUMBER_OF_PORTS)
  447.     {
  448.        bRetVal = FALSE;
  449.     }
  450.     else
  451.     {
  452.        // first set save the current state of the dest port
  453.        _Bool bSave = GetPortState(destPort);
  454.        P0 &= ~(0x03 << (2*destPort));  // Clear the existing mapping for this port
  455.                                    // This little hack only works when
  456.                                    // NUMBER_OF_PORTS == 4!
  457.                                    // Generally a more elaborate mechanism would
  458.                                    // be required that cleared all the bits of
  459.                                    // the port that control this destination port.
  460.        P0 |= (srcPort << (2*destPort));
  461.        SetPortState(destPort, bSave);  // Restore port state
  462.        bRetVal = TRUE;
  463.     }
  464.     return bRetVal;
  465. }

  466. // SetPortState - returns FALSE (0) if port is out of range.
  467. //                returns TRUE (1) if port is within range
  468. //                This function will only work correctly when
  469. //                NUMBER_OF_PORTS is 8 or less.
  470. _Bool SetPortState(unsigned char port, _Bool enable)
  471. {
  472.     _Bool bRetVal;
  473.     // Do some parameter checking
  474.     if(port >= NUMBER_OF_PORTS)
  475.     {
  476.        bRetVal = FALSE;
  477.     }
  478.     else
  479.     {
  480.        if(enable)
  481.        {
  482.           P1_ShadowReg |= (1 << port);  // OR in the correct port
  483.        }
  484.        else
  485.        {
  486.           P1_ShadowReg &= ~(1 << port); // AND out the correct port
  487.       
  488.        }
  489.        P1 = P1_ShadowReg;
  490.        bRetVal = TRUE;
  491.     }
  492.     return bRetVal;
  493. }

  494. // GetPortState - return FALSE (0) if port enable bit is not set or
  495. //                if port is out of range (TRUE otherwise).
  496. _Bool GetPortState(unsigned char port)
  497. {
  498.     if(port >= NUMBER_OF_PORTS)
  499.     {
  500.        return FALSE;  // Warning - unstructured error return.
  501.     }

  502.     return (P1_ShadowReg & (1 << port));
  503. }

  504. _Bool DumpPort(unsigned char port)
  505. {
  506.     _Bool bRetVal = FALSE;
  507.     signed char tmp;
  508.    
  509.     if(port < NUMBER_OF_PORTS)
  510.     {
  511.        tmp = port + 'A';
  512.        Transmit((const char *)&tmp, 1);
  513.        TransmitRomMsg(" <- ", 4);
  514.        // Extract the mapping
  515.        tmp = QueryConnection(port);
  516.        if(tmp >= 0 && tmp < NUMBER_OF_PORTS)
  517.        {
  518.           tmp += 'A';
  519.           Transmit((const char *)&tmp, 1);
  520.        }
  521.        else
  522.        {
  523.           // If we received an error display a question mark
  524.           TransmitRomMsg("?", 1);
  525.        }
  526.        if(GetPortState(port))
  527.        {
  528.           TransmitRomMsg(" enabled", 8);
  529.        }
  530.        else
  531.        {                                                
  532.           TransmitRomMsg(" disabled", 9);
  533.        }
  534.        bRetVal = TRUE;
  535.     }
  536.     return bRetVal;
  537. }

  538. signed char QueryConnection(unsigned char port)
  539. {
  540.     signed char retVal = -1;

  541.     if(port < NUMBER_OF_PORTS)
  542.     {
  543.        // Extract the mapping
  544.        retVal = P0;
  545.        retVal >>= (2*port);
  546.        retVal &= 0x03; // Only works for NUMBER_OF_PORTS = 4!
  547.     }
  548.     return retVal;
  549. }



  550. __interrupt(0x23) void SerialISR( void )
  551. {
  552.     char tempChar; // temporary variable to reduce the
  553.                    // amount of array dereferencing.
  554.     // Is there a TX interrupt?
  555.     if(TI)
  556.     {
  557.        TI = 0;  // clear int source as soon as possible to
  558.                 // minimise chances of missing an interrupt
  559.        // send the next character (if any) out to the port
  560.        if(isrTXIndex < isrTXLength)
  561.        {
  562.           // Another char to send - determine what sort of pointer we should
  563.           // use. When we are sending a ROM-based message use a
  564.           // __rom char *.  This saves having to copy the message into RAM.
  565.           // RAM is very limited in this application - only idata.
  566.           if(isrTXFromRom)
  567.           {
  568.              // We are sending a ROM message so use the ROM pointer
  569.              SBUF = isrTXBufROM[isrTXIndex++];
  570.           }
  571.           else
  572.           {
  573.               SBUF = isrTXBuf[isrTXIndex++];
  574.           }
  575.        }
  576.        else
  577.        {
  578.           // signal that we have finished transmitting
  579.           isrTXLength = 0;
  580.        }
  581.     }   // end of if(TI)  - transmit character handling
  582.    
  583.     // Is there an RX interrupt?
  584.     if(RI)
  585.     {
  586.        RI = 0;  // clear int source as soon as possible to
  587.                 // minimise chances of missing an RX interrupt

  588.        tempChar = SBUF;
  589.        // save this character away - if there is space
  590.        if(isrRXLength < RX_BUFFER_LENGTH-1)
  591.        {
  592.           // OK save it
  593.           isrRXBuf[isrRXLength++] = tempChar;
  594.        }
  595.        else
  596.        {
  597.           // Lets signal something
  598.           // I know! We can put the count of received chars onto
  599.           // Port 2. But we will do this outside the test so it
  600.           // is a useful count at all times.
  601.        }

  602.        // Deal with back spaces - watch for underflow of the
  603.        // buffer.
  604.        if(tempChar == RX_CMD_BACKSPACE)
  605.        {
  606.           if(isrRXLength > 1)
  607.           {
  608.             isrRXLength -= 2; // take off two to account for the just-added
  609.                               // backspace character
  610.           }
  611.           else
  612.           {
  613.             isrRXLength = 0; // only really useful for a signed variable
  614.           }
  615.           // Could print a space and then do the backspace again
  616.           // but I don't want to have to deal with potential recursion in
  617.           // calling the TX routines, or to possibly stuff up some outgoing
  618.           // transmission by forceably inserting a character into the transmit
  619.           // buffer.
  620.        }

  621.        // Debug ouput - Upper four bits of port 2 contain lower four bits of
  622.        // tempChar and lower four bits of port 2 contains lower four bits of
  623.        // isrRXLength
  624.        P2 = ((tempChar << 4) & 0xf0)|(0x0f & isrRXLength);
  625.        //P2 = isrRXLength; // signal the number of received characters onto port 2


  626.        // If the character was a command terminator then we need to
  627.        // pass it up to the high level.
  628.        if(tempChar == RX_CMD_TERMINATOR)
  629.        {
  630.           // new command buffer
  631.           if(isrUsingRXBuffer1)
  632.           {
  633.              rxBuffer1Length = isrRXLength;

  634.              // set up for further reception in the other RX buffer
  635.              isrRXBuf = rxBuffer2;
  636.              isrUsingRXBuffer1 = FALSE;

  637.              rxBuffer1Ready = TRUE;  // signal high level code
  638.           }
  639.           else
  640.           {
  641.              rxBuffer2Length = isrRXLength;
  642.              isrRXBuf = rxBuffer1;
  643.              isrUsingRXBuffer1 = TRUE;
  644.              rxBuffer2Ready = TRUE;
  645.           }
  646.           isrRXLength = 0;
  647.        }   // end of if(tempChar == RX_CMD_TERMINATOR )
  648.     }      // end of if(RI)  - receive character handling
  649. }
復制代碼


回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 久久精品国产精品青草 | 久久午夜精品 | 一级片av| av电影一区 | 2021狠狠干 | 激情小说综合网 | 久久成人免费观看 | 国产午夜精品一区二区三区在线观看 | 偷牌自拍| 日韩视频在线一区 | 日日操夜夜操天天操 | 91国内精精品久久久久久婷婷 | 91精品久久久久久久久久小网站 | 亚洲三级在线观看 | 精品一区二区三区四区五区 | 亚洲 中文 欧美 日韩 在线观看 | 国产精品欧美一区二区三区不卡 | 国产精品久久久久久久岛一牛影视 | 精品久久久久一区二区国产 | 久久久久黑人 | 夜夜草 | 国产精品一区二区不卡 | 香蕉久久a毛片 | 成人免费视频一区 | 一区二区三区在线免费观看视频 | 人人草人人干 | a级毛片国产 | 久久精品欧美一区二区三区不卡 | 久久久久免费观看 | 涩涩视频网站在线观看 | 成人av一区二区亚洲精 | 亚洲视频二区 | 成人美女免费网站视频 | 久久网日本 | 久久久.com| 视频一区二区三区四区五区 | 天天干天天玩天天操 | 欧美美女一区二区 | 久久国产精品网 | 久久99精品久久久久久 | 国产精品一二三区 |