FaxRxBufRawdata2pc.c
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:4k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. /************************************************
  2. Description: 
  3.       Send the received fax raw data to PC via MAX232
  4.       3G 1-dimensional Data Format Recommendation T.4
  5. Input:
  6.       none
  7. Output:
  8.       none
  9. Update:
  10.       2006.11.02  Bryan      function header     create
  11. ************************************************/
  12. #include "includeH.h"
  13. void  FaxRxBufRawdata2PCFromSoftUart(void) // send the received fax data to PC via MAX232
  14. {     
  15.       unsigned char ucFlashColumnAddCnt=0;
  16.       unsigned int wGeneralCnt=0,wPageAddress=0;
  17.       //ucGeneralCnt=2;
  18.       SOFTUART_PORT_DIRECTION |= bitSOFTUARTTX;
  19.       //wPageAddress=gwPageAddress;
  20.       ZERO_ADDRESS();
  21.       //for (gwPageAddress=1216;gwPageAddress<2559;gwPageAddress++) //Mar.2, 2007
  22.       for (wPageAddress=cstFaxRxBufStartPage;wPageAddress<=gwPageAddress;wPageAddress++)
  23.       {
  24.         
  25.         ROW_ADDRESS_LOW = wPageAddress & 0xff;
  26.         ROW_ADDRESS_HIGH = (wPageAddress>>8) & 0xff;
  27.         for (ucFlashColumnAddCnt = 0;ucFlashColumnAddCnt < 8;ucFlashColumnAddCnt++)
  28.         {
  29.             //8 * 256 == 2048 Bytes 2^4*2^8 12bit column address HighColumnAddr:0~8
  30.             //total 8*256B+64B=2K+64B
  31.     COLUMN_ADDRESS_HIGH=ucFlashColumnAddCnt;
  32.     READ_256_BYTE();//read 256 Byte to aucUartRxBuf[256]
  33.     for (wGeneralCnt=0;wGeneralCnt<256;wGeneralCnt++)//
  34.                                                           //modify Dec.28,2006 4*64Bytes one time
  35.     {
  36. SoftUartTxOneFrame(aucUartRxBuf[wGeneralCnt]);
  37. if (aucUartRxBuf[wGeneralCnt] == 0xfb && aucUartRxBuf[wGeneralCnt-1] == 0x13 && aucUartRxBuf[wGeneralCnt-2] == 0xff)
  38.   {_NOP();break;}             
  39.     }//third for
  40.     if (aucUartRxBuf[wGeneralCnt] == 0xfb && aucUartRxBuf[wGeneralCnt-1] == 0x13 && aucUartRxBuf[wGeneralCnt-2] == 0xff)
  41.   break;        
  42.         }//second for  next 256Byte
  43.        if (aucUartRxBuf[wGeneralCnt] == 0xfb && aucUartRxBuf[wGeneralCnt-1] == 0x13 && aucUartRxBuf[wGeneralCnt-2] == 0xff)
  44.   break; 
  45.        }//first for next page
  46.        
  47.        ATcmdDelay();     // receive data delay(if not, can't receive 0x10 0x03)
  48.        SOFTUART_PORT_DIRECTION &= ~bitSOFTUARTTX;
  49. }   
  50. /*
  51. void  FaxRxBufRawdata2PCFromUart(void) // send the received fax data to PC via MAX232
  52. {     
  53.       unsigned char ucFlashColumnAddCnt=0,ucGeneralCnt=0;
  54.       //ucGeneralCnt=2;
  55.       ZERO_ADDRESS();
  56.       for (gwPageAddress=cstFaxRxBufStartPage;gwPageAddress<2559;gwPageAddress++)
  57.       {
  58.         
  59.         ROW_ADDRESS_LOW = gwPageAddress & 0xff;
  60.         ROW_ADDRESS_HIGH = (gwPageAddress>>8) & 0xff;
  61.         for (ucFlashColumnAddCnt = 0;ucFlashColumnAddCnt < 8;ucFlashColumnAddCnt++)
  62.         {
  63.         //8 * 256 == 2048 Bytes 2^4*2^8 12bit column address HighColumnAddr:0~8
  64.             //total 8*256B+64B=2K+64B
  65.         COLUMN_ADDRESS_HIGH=ucFlashColumnAddCnt;
  66.         READ_256_BYTE();//read 256 Byte to aucUartRxBuf[256]
  67.         for (ucGeneralCnt=0;ucGeneralCnt<4;ucGeneralCnt++)//16*16Bytes send 16Bytes one time
  68.         {
  69.             Send64BytePageImageData(64,ucGeneralCnt);
  70.             while(gucTxBufCnt!=0)//send over, ucTxBufCnt == 0
  71.             { 
  72.               ;
  73.             }
  74.             //delay10ms();
  75.             if (gwTxNum != 64 && TXBUF0==0xfb)
  76.                 break;
  77.         }//third for
  78.         if (gwTxNum != 64)
  79.             break;
  80.         }//second for
  81.         
  82.         if (gwTxNum != 64)
  83.        break;      
  84.        }//first for next page
  85.        
  86.        ATcmdDelay();     // receive data delay(if not, can't receive 0x10 0x03)
  87. }   
  88. */