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

传真(Fax)编程

开发平台:

C/C++

  1.         NAME LCDView
  2.         RTMODEL "__double_size", "32"
  3.         RTMODEL "__pic", "no"
  4.         RTMODEL "__reg_r4", "free"
  5.         RTMODEL "__reg_r5", "free"
  6.         RTMODEL "__rt_version", "1"
  7.         RSEG CSTACK:DATA:SORT:NOROOT(1)
  8.         EXTERN gwTimeOverflowCount
  9.         EXTERN gucTimeOverflowCount
  10.         EXTERN gucGeneralStatus
  11.         EXTERN aucViewData
  12.         EXTERN delay1us
  13.         FUNCTION delay1us,0202H
  14.         EXTERN ?longjmp_r4
  15.         EXTERN ?longjmp_r5
  16.         EXTERN ?setjmp_r4
  17.         EXTERN ?setjmp_r5
  18.         PUBWEAK ?setjmp_save_r4
  19.         PUBWEAK ?setjmp_save_r5
  20.         PUBWEAK P4IN
  21.         PUBWEAK P4OUT
  22.         PUBLIC ReceiveOneViewData
  23.         FUNCTION ReceiveOneViewData,021203H
  24.         LOCFRAME CSTACK, 6, STACK
  25.         PUBLIC SendOneViewData
  26.         FUNCTION SendOneViewData,021203H
  27.         LOCFRAME CSTACK, 6, STACK
  28.         PUBLIC ViewCommunicationRX
  29.         FUNCTION ViewCommunicationRX,021203H
  30.         LOCFRAME CSTACK, 6, STACK
  31.         PUBLIC ViewCommunicationTX
  32.         FUNCTION ViewCommunicationTX,021203H
  33.         LOCFRAME CSTACK, 6, STACK
  34.         
  35.         CFI Names cfiNames0
  36.         CFI StackFrame CFA SP DATA
  37.         CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
  38.         CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
  39.         CFI EndNames cfiNames0
  40.         
  41.         CFI Common cfiCommon0 Using cfiNames0
  42.         CFI CodeAlign 2
  43.         CFI DataAlign 2
  44.         CFI ReturnAddress PC CODE
  45.         CFI CFA SP+2
  46.         CFI PC Frame(CFA, -2)
  47.         CFI SR Undefined
  48.         CFI R4 SameValue
  49.         CFI R5 SameValue
  50.         CFI R6 SameValue
  51.         CFI R7 SameValue
  52.         CFI R8 SameValue
  53.         CFI R9 SameValue
  54.         CFI R10 SameValue
  55.         CFI R11 SameValue
  56.         CFI R12 Undefined
  57.         CFI R13 Undefined
  58.         CFI R14 Undefined
  59.         CFI R15 Undefined
  60.         CFI EndCommon cfiCommon0
  61.         
  62. // E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesLCDView.c
  63. //    1 //LCD View
  64. //    2 //new  Apr. 06, 2007
  65. //    3 //Author bryan
  66. //    4 
  67. //    5 #include "includeH.h"
  68.         ASEGN DATA16_AN:DATA:NOROOT,01cH
  69. // unsigned char const volatile __data P4IN
  70. P4IN:
  71.         DS8 1
  72.         ASEGN DATA16_AN:DATA:NOROOT,01dH
  73. // unsigned char volatile __data P4OUT
  74. P4OUT:
  75.         DS8 1
  76. //    6 
  77. //    7 
  78. //    8 
  79.         RSEG CODE:CODE:NOROOT(1)
  80. //    9 void ViewCommunicationTX(unsigned char ViewTimeControlWord)
  81. ViewCommunicationTX:
  82.         CFI Block cfiBlock0 Using cfiCommon0
  83.         CFI Function ViewCommunicationTX
  84. //   10 {
  85.         FUNCALL ViewCommunicationTX, SendOneViewData
  86.         LOCFRAME CSTACK, 6, STACK
  87.         FUNCALL ViewCommunicationTX, SendOneViewData
  88.         LOCFRAME CSTACK, 6, STACK
  89.         FUNCALL ViewCommunicationTX, delay1us
  90.         LOCFRAME CSTACK, 6, STACK
  91. PUSH.W R10
  92.         CFI R10 Frame(CFA, -4)
  93.         CFI CFA SP+4
  94. PUSH.W R11
  95.         CFI R11 Frame(CFA, -6)
  96.         CFI CFA SP+6
  97. MOV.B R12, R10
  98. //   11      unsigned char ucGeneralCnt = 0;
  99. MOV.B #0x0, R11
  100. //   12      /*
  101. //   13       unsigned char ucYear=0xa1;
  102. //   14      unsigned char ucMonth=0xa2;
  103. //   15      unsigned char ucDate=0xa3;
  104. //   16       unsigned char ucHour=0xa4;
  105. //   17       unsigned char ucMinute=0xa5;
  106. //   18       unsigned char ucSecond=0xa6;
  107. //   19       unsigned char ucRingNum=0xa7;
  108. //   20       unsigned char ucIcon0=0xa8;
  109. //   21       unsigned char ucIcon1=0xa9;
  110. //   22       unsigned char ucIcon2=0xa0;
  111. //   23      */
  112. //   24       __disable_interrupt();
  113. DINT
  114. //   25   VIEW_PORT_OUT &= ~bitVIEWCLK;
  115. BIC.B #0x2, &0x1d
  116. //   26   while ((VIEW_PORT_IN & bitVIEWDATASI) == bitVIEWDATASI)//wait Low
  117. ??ViewCommunicationTX_0:
  118. BIT.B #0x1, &0x1c
  119. JNC ??ViewCommunicationTX_2
  120. //   27      {  
  121. //   28       if (gwTimeOverflowCount++ == 0xffff)
  122. MOV.W &gwTimeOverflowCount, R14
  123. MOV.W #0x1, R15
  124. ADD.W R14, R15
  125. MOV.W R15, &gwTimeOverflowCount
  126. CMP.W #0xffff, R14
  127. JNE ??ViewCommunicationTX_3
  128. //   29             gucTimeOverflowCount++;
  129. ADD.B #0x1, &gucTimeOverflowCount
  130. //   30         if (gucTimeOverflowCount == 10)
  131. ??ViewCommunicationTX_3:
  132. CMP.B #0xa, &gucTimeOverflowCount
  133. JNE ??ViewCommunicationTX_0
  134. //   31             {gucGeneralStatus &= ~bitSendFaxSignalOK;gucTimeOverflowCount=0;gwTimeOverflowCount=0;break;}
  135. BIC.B #0x10, &gucGeneralStatus
  136. MOV.B #0x0, &gucTimeOverflowCount
  137. MOV.W #0x0, &gwTimeOverflowCount
  138. //   32      } 
  139. //   33   if ((VIEW_PORT_IN & bitVIEWDATASI) != bitVIEWDATASI)
  140. ??ViewCommunicationTX_2:
  141. BIT.B #0x1, &0x1c
  142. JC ??ViewCommunicationTX_4
  143. //   34    {
  144. //   35       SendOneViewData(ViewTimeControlWord);//00 10Bytes is effect
  145. MOV.B R10, R12
  146. CALL #SendOneViewData
  147. //   36                                            //01 4Bytes is effect RingNum Icon2-1
  148. //   37       
  149. //   38        /*
  150. //   39        SendOneViewData(gucHour);
  151. //   40        SendOneViewData(gucMinute);
  152. //   41        SendOneViewData(gucSecond);
  153. //   42        SendOneViewData(gucMonth);
  154. //   43        SendOneViewData(gucDate);
  155. //   44        SendOneViewData(gucYear);
  156. //   45        SendOneViewData(gucViewRingNum);
  157. //   46        SendOneViewData(gucViewStaticStatus);
  158. //   47        SendOneViewData(gucViewDynamicStatus);
  159. //   48        SendOneViewData(gucIcon2);
  160. //   49        */
  161. //   50        for (ucGeneralCnt=0; ucGeneralCnt<10; ucGeneralCnt++)
  162. MOV.B #0x0, R11
  163. ??ViewCommunicationTX_1:
  164. CMP.B #0xa, R11
  165. JC ??ViewCommunicationTX_5
  166. //   51        {
  167. //   52            SendOneViewData(aucViewData[ucGeneralCnt]);
  168. MOV.B R11, R14
  169. AND.W #0xff, R14
  170. MOV.B aucViewData(R14), R12
  171. CALL #SendOneViewData
  172. //   53        }
  173. ADD.B #0x1, R11
  174. JMP ??ViewCommunicationTX_1
  175. //   54        
  176. //   55        delay1us(50);
  177. ??ViewCommunicationTX_5:
  178. MOV.W #0x32, R12
  179. CALL #delay1us
  180. //   56        VIEW_PORT_OUT |= bitVIEWCLK;
  181. BIS.B #0x2, &0x1d
  182. //   57        VIEW_PORT_OUT |= bitVIEWDATASO;
  183. BIS.B #0x4, &0x1d
  184. //   58    }
  185. //   59   _EINT();
  186. ??ViewCommunicationTX_4:
  187. EINT
  188. //   60 }
  189. POP.W R11
  190.         CFI R11 SameValue
  191.         CFI CFA SP+4
  192. POP.W R10
  193.         CFI R10 SameValue
  194.         CFI CFA SP+2
  195. RET
  196.         CFI EndBlock cfiBlock0
  197. //   61 
  198.         RSEG CODE:CODE:NOROOT(1)
  199. //   62 void ViewCommunicationRX(void)
  200. ViewCommunicationRX:
  201.         CFI Block cfiBlock1 Using cfiCommon0
  202.         CFI Function ViewCommunicationRX
  203. //   63 {
  204.         FUNCALL ViewCommunicationRX, ReceiveOneViewData
  205.         LOCFRAME CSTACK, 6, STACK
  206.         FUNCALL ViewCommunicationRX, delay1us
  207.         LOCFRAME CSTACK, 6, STACK
  208. PUSH.W R10
  209.         CFI R10 Frame(CFA, -4)
  210.         CFI CFA SP+4
  211. PUSH.W R11
  212.         CFI R11 Frame(CFA, -6)
  213.         CFI CFA SP+6
  214. //   64   unsigned char ucGeneralCnt = 0;   
  215. MOV.B #0x0, R10
  216. //   65   __disable_interrupt();
  217. DINT
  218. //   66   while ((VIEW_PORT_IN & bitVIEWDATASI) != bitVIEWDATASI)//wait Low
  219. ??ViewCommunicationRX_0:
  220. BIT.B #0x1, &0x1c
  221. JC ??ViewCommunicationRX_3
  222. //   67      {  
  223. //   68       //if ((gucGeneralStatus & bitModemActive) == bitModemActive)
  224. //   69         //break;
  225. //   70       if (gwTimeOverflowCount++ == 0xffff)
  226. MOV.W &gwTimeOverflowCount, R14
  227. MOV.W #0x1, R15
  228. ADD.W R14, R15
  229. MOV.W R15, &gwTimeOverflowCount
  230. CMP.W #0xffff, R14
  231. JNE ??ViewCommunicationRX_4
  232. //   71             gucTimeOverflowCount++;
  233. ADD.B #0x1, &gucTimeOverflowCount
  234. //   72         if (gucTimeOverflowCount == 10)
  235. ??ViewCommunicationRX_4:
  236. CMP.B #0xa, &gucTimeOverflowCount
  237. JNE ??ViewCommunicationRX_0
  238. //   73             {gucGeneralStatus &= ~bitSendFaxSignalOK;gucTimeOverflowCount=0;gwTimeOverflowCount=0;break;}
  239. BIC.B #0x10, &gucGeneralStatus
  240. MOV.B #0x0, &gucTimeOverflowCount
  241. MOV.W #0x0, &gwTimeOverflowCount
  242. //   74      } 
  243. //   75   VIEW_PORT_OUT &= ~bitVIEWCLK;
  244. ??ViewCommunicationRX_3:
  245. BIC.B #0x2, &0x1d
  246. //   76   while ((VIEW_PORT_IN & bitVIEWDATASI) == bitVIEWDATASI)//wait Low
  247. ??ViewCommunicationRX_1:
  248. BIT.B #0x1, &0x1c
  249. JNC ??ViewCommunicationRX_5
  250. //   77      {  
  251. //   78       if ((gucGeneralStatus & bitModemActive) == bitModemActive)
  252. BIT.B #0x2, &gucGeneralStatus
  253. JNC ??ViewCommunicationRX_1
  254. //   79         break;
  255. //   80      } 
  256. //   81   if ((VIEW_PORT_IN & bitVIEWDATASI) != bitVIEWDATASI)
  257. ??ViewCommunicationRX_5:
  258. BIT.B #0x1, &0x1c
  259. JC ??ViewCommunicationRX_6
  260. //   82    {
  261. //   83      /*
  262. //   84      SendOneViewData(0x80);
  263. //   85      gucHour=ReceiveOneViewData();
  264. //   86      gucMinute=ReceiveOneViewData();
  265. //   87      gucSecond=ReceiveOneViewData();
  266. //   88      gucMonth = ReceiveOneViewData();
  267. //   89      gucDate = ReceiveOneViewData();
  268. //   90      gucYear = ReceiveOneViewData();
  269. //   91      gucViewRingNum=ReceiveOneViewData();
  270. //   92      gucViewStaticStatus=ReceiveOneViewData();
  271. //   93      gucViewDynamicStatus=ReceiveOneViewData();
  272. //   94      gucIcon2=ReceiveOneViewData();
  273. //   95      */
  274. //   96      for (ucGeneralCnt=0; ucGeneralCnt<10; ucGeneralCnt++)
  275. MOV.B #0x0, R10
  276. ??ViewCommunicationRX_2:
  277. CMP.B #0xa, R10
  278. JC ??ViewCommunicationRX_7
  279. //   97           {
  280. //   98               aucViewData[ucGeneralCnt]=ReceiveOneViewData();
  281. MOV.B R10, R11
  282. AND.W #0xff, R11
  283. CALL #ReceiveOneViewData
  284. MOV.B R12, aucViewData(R11)
  285. //   99           }
  286. ADD.B #0x1, R10
  287. JMP ??ViewCommunicationRX_2
  288. //  100      delay1us(50);
  289. ??ViewCommunicationRX_7:
  290. MOV.W #0x32, R12
  291. CALL #delay1us
  292. //  101      VIEW_PORT_OUT |= bitVIEWCLK;
  293. BIS.B #0x2, &0x1d
  294. //  102    }
  295. //  103   
  296. //  104   _EINT();
  297. ??ViewCommunicationRX_6:
  298. EINT
  299. //  105  
  300. //  106 }
  301. POP.W R11
  302.         CFI R11 SameValue
  303.         CFI CFA SP+4
  304. POP.W R10
  305.         CFI R10 SameValue
  306.         CFI CFA SP+2
  307. RET
  308.         CFI EndBlock cfiBlock1
  309. //  107 
  310. //  108 
  311. //  109 
  312.         RSEG CODE:CODE:NOROOT(1)
  313. //  110 void SendOneViewData(unsigned char ucViewTxData)
  314. SendOneViewData:
  315.         CFI Block cfiBlock2 Using cfiCommon0
  316.         CFI Function SendOneViewData
  317. //  111 {
  318.         FUNCALL SendOneViewData, delay1us
  319.         LOCFRAME CSTACK, 6, STACK
  320.         FUNCALL SendOneViewData, delay1us
  321.         LOCFRAME CSTACK, 6, STACK
  322.         FUNCALL SendOneViewData, delay1us
  323.         LOCFRAME CSTACK, 6, STACK
  324. PUSH.W R10
  325.         CFI R10 Frame(CFA, -4)
  326.         CFI CFA SP+4
  327. PUSH.W R11
  328.         CFI R11 Frame(CFA, -6)
  329.         CFI CFA SP+6
  330. MOV.B R12, R10
  331. //  112   unsigned char ucGeneralCount=0;
  332. MOV.B #0x0, R11
  333. //  113   for (ucGeneralCount=0;ucGeneralCount<8;ucGeneralCount++)
  334. MOV.B #0x0, R11
  335. ??SendOneViewData_0:
  336. CMP.B #0x8, R11
  337. JC ??SendOneViewData_1
  338. //  114      {
  339. //  115         VIEW_PORT_OUT &= ~bitVIEWCLK;
  340. BIC.B #0x2, &0x1d
  341. //  116         delay1us(50);//
  342. MOV.W #0x32, R12
  343. CALL #delay1us
  344. //  117         if ((ucViewTxData & BIT0) == BIT0)
  345. BIT.B #0x1, R10
  346. JNC ??SendOneViewData_2
  347. //  118           {VIEW_PORT_OUT |= bitVIEWDATASO;} //set   Tx bit
  348. BIS.B #0x4, &0x1d
  349. JMP ??SendOneViewData_3
  350. //  119         else
  351. //  120           {VIEW_PORT_OUT &= ~bitVIEWDATASO;} //reset Tx bit
  352. ??SendOneViewData_2:
  353. BIC.B #0x4, &0x1d
  354. //  121         ucViewTxData=ucViewTxData>>1; 
  355. ??SendOneViewData_3:
  356. CLRC
  357. RRC.B R10
  358. //  122         delay1us(50);//
  359. MOV.W #0x32, R12
  360. CALL #delay1us
  361. //  123         VIEW_PORT_OUT |= bitVIEWCLK;
  362. BIS.B #0x2, &0x1d
  363. //  124         delay1us(100);
  364. MOV.W #0x64, R12
  365. CALL #delay1us
  366. //  125         VIEW_PORT_OUT &= ~bitVIEWCLK;
  367. BIC.B #0x2, &0x1d
  368. //  126         
  369. //  127      }
  370. ADD.B #0x1, R11
  371. JMP ??SendOneViewData_0
  372. //  128 }
  373. ??SendOneViewData_1:
  374. POP.W R11
  375.         CFI R11 SameValue
  376.         CFI CFA SP+4
  377. POP.W R10
  378.         CFI R10 SameValue
  379.         CFI CFA SP+2
  380. RET
  381.         CFI EndBlock cfiBlock2
  382. //  129 
  383.         RSEG CODE:CODE:NOROOT(1)
  384. //  130 unsigned char ReceiveOneViewData(void)
  385. ReceiveOneViewData:
  386.         CFI Block cfiBlock3 Using cfiCommon0
  387.         CFI Function ReceiveOneViewData
  388. //  131 {
  389.         FUNCALL ReceiveOneViewData, delay1us
  390.         LOCFRAME CSTACK, 6, STACK
  391.         FUNCALL ReceiveOneViewData, delay1us
  392.         LOCFRAME CSTACK, 6, STACK
  393.         FUNCALL ReceiveOneViewData, delay1us
  394.         LOCFRAME CSTACK, 6, STACK
  395. PUSH.W R10
  396.         CFI R10 Frame(CFA, -4)
  397.         CFI CFA SP+4
  398. PUSH.W R11
  399.         CFI R11 Frame(CFA, -6)
  400.         CFI CFA SP+6
  401. //  132   unsigned char ucGeneralCount=0;
  402. MOV.B #0x0, R11
  403. //  133   unsigned char ucViewRxData;
  404. //  134   for (ucGeneralCount=0;ucGeneralCount<8;ucGeneralCount++)
  405. MOV.B #0x0, R11
  406. ??ReceiveOneViewData_0:
  407. CMP.B #0x8, R11
  408. JC ??ReceiveOneViewData_1
  409. //  135      {
  410. //  136         ucViewRxData=ucViewRxData>>1;
  411. CLRC
  412. RRC.B R10
  413. //  137         VIEW_PORT_OUT &= ~bitVIEWCLK;
  414. BIC.B #0x2, &0x1d
  415. //  138         delay1us(100);
  416. MOV.W #0x64, R12
  417. CALL #delay1us
  418. //  139         VIEW_PORT_OUT |= bitVIEWCLK;
  419. BIS.B #0x2, &0x1d
  420. //  140         delay1us(50);
  421. MOV.W #0x32, R12
  422. CALL #delay1us
  423. //  141         if ((VIEW_PORT_IN & bitVIEWDATASI) == bitVIEWDATASI)
  424. BIT.B #0x1, &0x1c
  425. JNC ??ReceiveOneViewData_2
  426. //  142           {ucViewRxData |= BIT7;} //1
  427. BIS.B #0x80, R10
  428. JMP ??ReceiveOneViewData_3
  429. //  143         else
  430. //  144           {ucViewRxData &= ~BIT7;} //0
  431. ??ReceiveOneViewData_2:
  432. BIC.B #0x80, R10
  433. //  145         
  434. //  146         delay1us(50);
  435. ??ReceiveOneViewData_3:
  436. MOV.W #0x32, R12
  437. CALL #delay1us
  438. //  147         VIEW_PORT_OUT &= ~bitVIEWCLK;
  439. BIC.B #0x2, &0x1d
  440. //  148      }
  441. ADD.B #0x1, R11
  442. JMP ??ReceiveOneViewData_0
  443. //  149    return  ucViewRxData; 
  444. ??ReceiveOneViewData_1:
  445. MOV.B R10, R12
  446. POP.W R11
  447.         CFI R11 SameValue
  448.         CFI CFA SP+4
  449. POP.W R10
  450.         CFI R10 SameValue
  451.         CFI CFA SP+2
  452. RET
  453.         CFI EndBlock cfiBlock3
  454. //  150 } 
  455.         RSEG CODE:CODE:NOROOT(1)
  456. ?setjmp_save_r4:
  457. REQUIRE ?setjmp_r4
  458. REQUIRE ?longjmp_r4
  459.         RSEG CODE:CODE:NOROOT(1)
  460. ?setjmp_save_r5:
  461. REQUIRE ?setjmp_r5
  462. REQUIRE ?longjmp_r5
  463.         END
  464. //  151 
  465. //  152 /*
  466. //  153         if ((VIEW_PORT_OUT & bitVIEWCLK) == bitVIEWCLK)
  467. //  154           {VIEW_PORT_OUT &= ~bitVIEWDATA;} //Reset CLOCK
  468. //  155         else
  469. //  156           {VIEW_PORT_OUT |= bitVIEWDATA;} //set CLOCK
  470. //  157 */ 
  471. // 
  472. // 406 bytes in segment CODE
  473. //   2 bytes in segment DATA16_AN
  474. // 
  475. // 406 bytes of CODE memory
  476. //   0 bytes of DATA memory (+ 2 bytes shared)
  477. //
  478. //Errors: none
  479. //Warnings: none