|
|
View previous topic :: View next topic |
Author |
Message |
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
STRANGE PROBLEM IN 18F4620 |
Posted: Tue Feb 08, 2005 8:16 am |
|
|
Hi,
I have a very strange problem, in the attach LST if I change the size of variable sBuffer ( in the main section) with the define MF_BUFFER_SIZE to < 239 bytes I not received nothing!!!!! by my SERIAL_MF stream. If I define the size to 255 work.
With the 18F8720 work ok in two sizes.
Is a bug? or a programming problem?, or the C1 & C2 are the problem?
Somebody know why happend this?
Thank you very much!! |
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Feb 08, 2005 8:17 am |
|
|
This is the LST CODE.
Code: |
MPASM
CCS PCH C Compiler, Version 3.218, 25972 08-Feb-05 11:14
Filename: iMFRTest.LST
ROM used: 1002 bytes (2%)
Largest free fragment is 64534
RAM used: 43 (1%) at main() level
57 (1%) worst case
Stack: 4 locations
0000 EF85 F001 00001 GOTO 030A
0000 00002 .................... #include <18F4620.h>
0000 00003 .................... //////// Standard Header file for the PIC18F4620 device ////////////////
0000 00004 .................... #device PIC18F4620
0000 00558 .................... #list
0000 00559 ....................
0000 00560 .................... #device *=16
0000 00561 .................... #device adc=8
0000 00562 .................... #case
0000 00563 .................... #use delay(clock=25000000)
0000 00564 .................... #fuses HS,NOWDT,NOLVP,PROTECT
0000 00565 .................... #opt 11
0000 00566 .................... #ignore_warnings 203,204,205,206
0000 00567 .................... #zero_ram
0000 00568 .................... #use rs232( BAUD = 115200, PARITY = N, XMIT = PIN_C6, RCV = PIN_C7, BITS = 8, STREAM = SERIAL_2 ) //, ERRORS, DISABLE_INTS )
0000 00569 ....................
0000 00570 .................... #use rs232( BAUD= 115200, PARITY = N, XMIT = PIN_C2, RCV = PIN_C1, BITS = 8, STREAM = SERIAL_MF, SAMPLE_EARLY, FORCE_SW, ERRORS )
01C8 9494 00571 BCF F94.2
01CA 948B 00572 BCF F8B.2
01CC 0E08 00573 MOVLW 08
01CE 6E01 00574 MOVWF 01
01D0 0000 00575 NOP
01D2 0000 00576 NOP
01D4 0000 00577 NOP
01D6 8E01 00578 BSF 01.7
01D8 D013 00579 BRA 0200
01DA 9E01 00580 BCF 01.7
01DC C031 F002 00581 MOVFF 31,02
01E0 3202 00582 RRCF 02,F
01E2 B0D8 00583 BTFSC FD8.0
01E4 848B 00584 BSF F8B.2
01E6 A0D8 00585 BTFSS FD8.0
01E8 948B 00586 BCF F8B.2
01EA 8C01 00587 BSF 01.6
01EC D009 00588 BRA 0200
01EE 9C01 00589 BCF 01.6
01F0 2E01 00590 DECFSZ 01,F
01F2 D7F6 00591 BRA 01E0
01F4 C002 F031 00592 MOVFF 02,31
01F8 0000 00593 NOP
01FA 0000 00594 NOP
01FC 0000 00595 NOP
01FE 848B 00596 BSF F8B.2
0200 0E0B 00597 MOVLW 0B
0202 6EE9 00598 MOVWF FE9
0204 2EE9 00599 DECFSZ FE9,F
0206 D7FE 00600 BRA 0204
0208 BE01 00601 BTFSC 01.7
020A D7E7 00602 BRA 01DA
020C BC01 00603 BTFSC 01.6
020E D7EF 00604 BRA 01EE
0210 EF23 F001 00605 GOTO 0246 (RETURN)
0262 0E08 00606 MOVLW 08
0264 6E00 00607 MOVWF 00
0266 8294 00608 BSF F94.1
0268 B282 00609 BTFSC F82.1
026A D7FE 00610 BRA 0268
026C 6A34 00611 CLRF 34
026E 9E00 00612 BCF 00.7
0270 D00E 00613 BRA 028E
0272 C034 F002 00614 MOVFF 34,02
0276 90D8 00615 BCF FD8.0
0278 B282 00616 BTFSC F82.1
027A 80D8 00617 BSF FD8.0
027C 3202 00618 RRCF 02,F
027E 8C00 00619 BSF 00.6
0280 D006 00620 BRA 028E
0282 9C00 00621 BCF 00.6
0284 2E00 00622 DECFSZ 00,F
0286 D7F7 00623 BRA 0276
0288 C002 F001 00624 MOVFF 02,01
028C D00D 00625 BRA 02A8
028E 0E0B 00626 MOVLW 0B
0290 BE00 00627 BTFSC 00.7
0292 0E03 00628 MOVLW 03
0294 6E01 00629 MOVWF 01
0296 2E01 00630 DECFSZ 01,F
0298 D7FE 00631 BRA 0296
029A 0000 00632 NOP
029C 0000 00633 NOP
029E BE00 00634 BTFSC 00.7
02A0 D7E6 00635 BRA 026E
02A2 BC00 00636 BTFSC 00.6
02A4 D7EE 00637 BRA 0282
02A6 D7E7 00638 BRA 0276
02A8 EF6E F001 00639 GOTO 02DC (RETURN)
0000 00640 ....................
0000 00641 ....................
0000 00642 ....................
0000 00643 .................... #define MF_SERIAL_PORT SERIAL_MF
0000 00644 .................... #define MF_DEBUG_PORT SERIAL_2
0000 00645 ....................
0000 00646 ....................
0000 00647 .................... #define MF_RESPONSE_TIMEOUT 25000
0000 00648 .................... #define MF_TRANSMIT_TIMEOUT 50
0000 00649 ....................
0000 00650 .................... #define MF_BUFFER_SIZE 32
0000 00651 ....................
0000 00652 ....................
0000 00653 ....................
0000 00654 .................... void MF_Debug( int1 siTXRX, char *sData, int iDataLen )
0000 00655 .................... {
0000 00656 .................... int iPtr;
0000 00657 ....................
0000 00658 .................... if ( siTXRX )
0130 5230 00659 MOVF 30,F
0132 E00B 00660 BZ 014A
0000 00661 .................... fprintf( MF_DEBUG_PORT, "%s", "TX" );
0134 6A35 00662 CLRF 35
0136 5035 00663 MOVF 35,W
0138 DF65 00664 RCALL 0004
013A 0900 00665 IORLW 00
013C E005 00666 BZ 0148
013E 2A35 00667 INCF 35,F
0140 A89E 00668 BTFSS F9E.4
0142 D7FE 00669 BRA 0140
0144 6EAD 00670 MOVWF FAD
0146 D7F7 00671 BRA 0136
0000 00672 .................... else
0148 D00A 00673 BRA 015E
0000 00674 .................... fprintf( MF_DEBUG_PORT, "%s", "RX" );
014A 6A35 00675 CLRF 35
014C 5035 00676 MOVF 35,W
014E DF64 00677 RCALL 0018
0150 0900 00678 IORLW 00
0152 E005 00679 BZ 015E
0154 2A35 00680 INCF 35,F
0156 A89E 00681 BTFSS F9E.4
0158 D7FE 00682 BRA 0156
015A 6EAD 00683 MOVWF FAD
015C D7F7 00684 BRA 014C
0000 00685 ....................
0000 00686 .................... fprintf( MF_DEBUG_PORT, "(%03U) [", iDataLen );
015E 0E28 00687 MOVLW 28
0160 A89E 00688 BTFSS F9E.4
0162 D7FE 00689 BRA 0160
0164 6EAD 00690 MOVWF FAD
0166 C033 F035 00691 MOVFF 33,35
016A 6A36 00692 CLRF 36
016C D773 00693 BRA 0054
016E 0E29 00694 MOVLW 29
0170 A89E 00695 BTFSS F9E.4
0172 D7FE 00696 BRA 0170
0174 6EAD 00697 MOVWF FAD
0176 0E20 00698 MOVLW 20
0178 A89E 00699 BTFSS F9E.4
017A D7FE 00700 BRA 0178
017C 6EAD 00701 MOVWF FAD
017E 0E5B 00702 MOVLW 5B
0180 A89E 00703 BTFSS F9E.4
0182 D7FE 00704 BRA 0180
0184 6EAD 00705 MOVWF FAD
0000 00706 ....................
0000 00707 .................... for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
0186 6A34 00708 CLRF 34
0188 5033 00709 MOVF 33,W
018A 5C34 00710 SUBWF 34,W
018C E210 00711 BC 01AE
0000 00712 .................... fprintf( MF_DEBUG_PORT, "%02X", sData[ iPtr ] );
018E 6A03 00713 CLRF 03
0190 5034 00714 MOVF 34,W
0192 2431 00715 ADDWF 31,W
0194 6EE9 00716 MOVWF FE9
0196 5032 00717 MOVF 32,W
0198 2003 00718 ADDWFC 03,W
019A 6EEA 00719 MOVWF FEA
019C CFEF F035 00720 MOVFF FEF,35
01A0 C035 F036 00721 MOVFF 35,36
01A4 0E37 00722 MOVLW 37
01A6 6E37 00723 MOVWF 37
01A8 D7A1 00724 BRA 00EC
01AA 2A34 00725 INCF 34,F
01AC D7ED 00726 BRA 0188
0000 00727 ....................
0000 00728 .................... fprintf( MF_DEBUG_PORT, "]\n\r" );
01AE 0E5D 00729 MOVLW 5D
01B0 A89E 00730 BTFSS F9E.4
01B2 D7FE 00731 BRA 01B0
01B4 6EAD 00732 MOVWF FAD
01B6 0E0A 00733 MOVLW 0A
01B8 A89E 00734 BTFSS F9E.4
01BA D7FE 00735 BRA 01B8
01BC 6EAD 00736 MOVWF FAD
01BE 0E0D 00737 MOVLW 0D
01C0 A89E 00738 BTFSS F9E.4
01C2 D7FE 00739 BRA 01C0
01C4 6EAD 00740 MOVWF FAD
0000 00741 .................... }
01C6 0C00 00742 RETLW 00
0000 00743 ....................
0000 00744 ....................
0000 00745 ....................
0000 00746 .................... void MF_Kbhit( int16 lTimeOut )
0000 00747 .................... {
0000 00748 .................... while ( !kbhit( MF_SERIAL_PORT ) && --lTimeOut );
024E A282 00749 BTFSS F82.1
0250 D007 00750 BRA 0260
0252 502F 00751 MOVF 2F,W
0254 B4D8 00752 BTFSC FD8.2
0256 0630 00753 DECF 30,F
0258 062F 00754 DECF 2F,F
025A 502F 00755 MOVF 2F,W
025C 1030 00756 IORWF 30,W
025E E1F7 00757 BNZ 024E
0000 00758 .................... }
0260 0C00 00759 RETLW 00
0000 00760 ....................
0000 00761 ....................
0000 00762 ....................
0000 00763 .................... void MF_SendFrame( char *sData, int iDataLen )
0000 00764 .................... {
0000 00765 .................... int iPtr;
0000 00766 ....................
0000 00767 .................... MF_Debug( TRUE, sData, iDataLen );
0214 0E01 00768 MOVLW 01
0216 6E30 00769 MOVWF 30
0218 C02D F032 00770 MOVFF 2D,32
021C C02C F031 00771 MOVFF 2C,31
0220 C02E F033 00772 MOVFF 2E,33
0224 DF85 00773 RCALL 0130
0000 00774 ....................
0000 00775 .................... for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
0226 6A2F 00776 CLRF 2F
0228 502E 00777 MOVF 2E,W
022A 5C2F 00778 SUBWF 2F,W
022C E20E 00779 BC 024A
0000 00780 .................... fputc( sData[ iPtr ], MF_SERIAL_PORT );
022E 6A03 00781 CLRF 03
0230 502F 00782 MOVF 2F,W
0232 242C 00783 ADDWF 2C,W
0234 6EE9 00784 MOVWF FE9
0236 502D 00785 MOVF 2D,W
0238 2003 00786 ADDWFC 03,W
023A 6EEA 00787 MOVWF FEA
023C CFEF F030 00788 MOVFF FEF,30
0240 C030 F031 00789 MOVFF 30,31
0244 D7C1 00790 BRA 01C8
0246 2A2F 00791 INCF 2F,F
0248 D7EF 00792 BRA 0228
0000 00793 .................... }
024A EFE5 F001 00794 GOTO 03CA (RETURN)
0000 00795 ....................
0000 00796 ....................
0000 00797 ....................
0000 00798 .................... int MF_RecvFrame( char *sData )
0000 00799 .................... {
0000 00800 .................... int iLen = 0;
02AC 6A2E 00801 CLRF 2E
0000 00802 ....................
0000 00803 .................... MF_Kbhit( MF_RESPONSE_TIMEOUT );
02AE 0E61 00804 MOVLW 61
02B0 6E30 00805 MOVWF 30
02B2 0EA8 00806 MOVLW A8
02B4 6E2F 00807 MOVWF 2F
02B6 DFCB 00808 RCALL 024E
0000 00809 ....................
0000 00810 .................... while ( kbhit( MF_SERIAL_PORT ) && iLen < MF_BUFFER_SIZE )
0000 00811 .................... {
02B8 B282 00812 BTFSC F82.1
02BA D01B 00813 BRA 02F2
02BC 502E 00814 MOVF 2E,W
02BE 081F 00815 SUBLW 1F
02C0 E318 00816 BNC 02F2
0000 00817 .................... sData[ iLen++ ] = fgetc( MF_SERIAL_PORT );
02C2 502E 00818 MOVF 2E,W
02C4 2A2E 00819 INCF 2E,F
02C6 6A03 00820 CLRF 03
02C8 242C 00821 ADDWF 2C,W
02CA 6EE9 00822 MOVWF FE9
02CC 502D 00823 MOVF 2D,W
02CE 2003 00824 ADDWFC 03,W
02D0 6EEA 00825 MOVWF FEA
02D2 CFEA F033 00826 MOVFF FEA,33
02D6 CFE9 F032 00827 MOVFF FE9,32
02DA D7C3 00828 BRA 0262
02DC C033 FFEA 00829 MOVFF 33,FEA
02E0 C032 FFE9 00830 MOVFF 32,FE9
02E4 C001 FFEF 00831 MOVFF 01,FEF
0000 00832 .................... MF_Kbhit( MF_TRANSMIT_TIMEOUT );
02E8 6A30 00833 CLRF 30
02EA 0E32 00834 MOVLW 32
02EC 6E2F 00835 MOVWF 2F
02EE DFAF 00836 RCALL 024E
0000 00837 .................... }
02F0 D7E3 00838 BRA 02B8
0000 00839 ....................
0000 00840 .................... MF_Debug( FALSE, sData, iLen );
02F2 6A30 00841 CLRF 30
02F4 C02D F032 00842 MOVFF 2D,32
02F8 C02C F031 00843 MOVFF 2C,31
02FC C02E F033 00844 MOVFF 2E,33
0300 DF17 00845 RCALL 0130
0000 00846 ....................
0000 00847 .................... return iLen;
0302 C02E F001 00848 MOVFF 2E,01
0000 00849 .................... }
0306 EFE9 F001 00850 GOTO 03D2 (RETURN)
0000 00851 ....................
0000 00852 ....................
0000 00853 ....................
0000 00854 .................... void main()
0000 00855 .................... {
030A 6AF8 00856 CLRF FF8
030C 9ED0 00857 BCF FD0.7
030E 0EFE 00858 MOVLW FE
0310 6E00 00859 MOVWF 00
0312 0E10 00860 MOVLW 10
0314 6E01 00861 MOVWF 01
0316 6AEA 00862 CLRF FEA
0318 0E02 00863 MOVLW 02
031A 6EE9 00864 MOVWF FE9
031C 6AEF 00865 CLRF FEF
031E 2AE9 00866 INCF FE9,F
0320 B4D8 00867 BTFSC FD8.2
0322 2AEA 00868 INCF FEA,F
0324 2E00 00869 DECFSZ 00,F
0326 D7FA 00870 BRA 031C
0328 2E01 00871 DECFSZ 01,F
032A D7F8 00872 BRA 031C
032C 6AEA 00873 CLRF FEA
032E 6AE9 00874 CLRF FE9
0330 50C1 00875 MOVF FC1,W
0332 0BC0 00876 ANDLW C0
0334 090F 00877 IORLW 0F
0336 6EC1 00878 MOVWF FC1
0338 0E07 00879 MOVLW 07
033A 6EB4 00880 MOVWF FB4
033C 50B4 00881 MOVF FB4,W
033E 9CA1 00882 BCF FA1.6
0340 86B8 00883 BSF FB8.3
0342 0E35 00884 MOVLW 35
0344 6EAF 00885 MOVWF FAF
0346 0E26 00886 MOVLW 26
0348 6EAC 00887 MOVWF FAC
034A 0E90 00888 MOVLW 90
034C 6EAB 00889 MOVWF FAB
034E 9494 00890 BCF F94.2
0350 848B 00891 BSF F8B.2
0000 00892 .................... //
0000 00893 .................... // Defino variables locales
0000 00894 .................... //
0000 00895 .................... int iRet;
0000 00896 .................... char sBuffer[ MF_BUFFER_SIZE ];
0000 00897 .................... char sGetInfo[ 5 ] = { 0x16, 0x00, 0x4F, 0x00, 0x4F };
0352 0E16 00898 MOVLW 16
0354 6E27 00899 MOVWF 27
0356 6A28 00900 CLRF 28
0358 0E4F 00901 MOVLW 4F
035A 6E29 00902 MOVWF 29
035C 6A2A 00903 CLRF 2A
035E 6E2B 00904 MOVWF 2B
0000 00905 ....................
0000 00906 ....................
0000 00907 .................... setup_adc_ports(NO_ANALOGS);
0360 50C1 00908 MOVF FC1,W
0362 0BC0 00909 ANDLW C0
0364 090F 00910 IORLW 0F
0366 6EC1 00911 MOVWF FC1
0000 00912 .................... setup_adc(ADC_OFF);
0368 90C2 00913 BCF FC2.0
0000 00914 .................... setup_ccp1(CCP_OFF);
036A 0EB7 00915 MOVLW B7
036C 16B1 00916 ANDWF FB1,F
036E 8494 00917 BSF F94.2
0370 6ABD 00918 CLRF FBD
0372 6ABD 00919 CLRF FBD
0000 00920 .................... setup_ccp2(CCP_OFF);
0374 16B1 00921 ANDWF FB1,F
0376 8294 00922 BSF F94.1
0378 6ABA 00923 CLRF FBA
037A 6ABA 00924 CLRF FBA
037C 6AB6 00925 CLRF FB6
037E 6AB7 00926 CLRF FB7
0000 00927 .................... setup_comparator(NC_NC_NC_NC);
0380 0E07 00928 MOVLW 07
0382 6EB4 00929 MOVWF FB4
0384 5092 00930 MOVF F92,W
0386 0E14 00931 MOVLW 14
0388 6E00 00932 MOVWF 00
038A 2E00 00933 DECFSZ 00,F
038C D7FE 00934 BRA 038A
038E 0000 00935 NOP
0390 50B4 00936 MOVF FB4,W
0392 9CA1 00937 BCF FA1.6
0000 00938 .................... setup_vref(FALSE);
0394 6AB5 00939 CLRF FB5
0000 00940 .................... setup_psp(PSP_DISABLED);
0396 9896 00941 BCF F96.4
0000 00942 .................... setup_spi(FALSE);
0398 9AC6 00943 BCF FC6.5
039A 9A94 00944 BCF F94.5
039C 8894 00945 BSF F94.4
039E 9694 00946 BCF F94.3
03A0 0E00 00947 MOVLW 00
03A2 6EC6 00948 MOVWF FC6
03A4 6EC7 00949 MOVWF FC7
0000 00950 .................... setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
03A6 90D1 00951 BCF FD1.0
03A8 0E80 00952 MOVLW 80
03AA 6ED5 00953 MOVWF FD5
0000 00954 .................... setup_timer_1(T1_DISABLED);
03AC 6ACD 00955 CLRF FCD
0000 00956 .................... setup_timer_2(T2_DISABLED,0,1);
03AE 0E00 00957 MOVLW 00
03B0 6ECA 00958 MOVWF FCA
03B2 0E00 00959 MOVLW 00
03B4 6ECB 00960 MOVWF FCB
0000 00961 .................... disable_interrupts( GLOBAL );
03B6 9CF2 00962 BCF FF2.6
03B8 9EF2 00963 BCF FF2.7
03BA BEF2 00964 BTFSC FF2.7
03BC D7FD 00965 BRA 03B8
0000 00966 ....................
0000 00967 ....................
0000 00968 .................... MF_SendFrame( sGetInfo, 5 );
03BE 6A2D 00969 CLRF 2D
03C0 0E27 00970 MOVLW 27
03C2 6E2C 00971 MOVWF 2C
03C4 0E05 00972 MOVLW 05
03C6 6E2E 00973 MOVWF 2E
03C8 D725 00974 BRA 0214
0000 00975 .................... iRet = MF_RecvFrame( sBuffer );
03CA 6A2D 00976 CLRF 2D
03CC 0E07 00977 MOVLW 07
03CE 6E2C 00978 MOVWF 2C
03D0 D76D 00979 BRA 02AC
03D2 C001 F006 00980 MOVFF 01,06
0000 00981 ....................
0000 00982 ....................
0000 00983 .................... fprintf( SERIAL_2, "\n\r" );
03D6 0E0A 00984 MOVLW 0A
03D8 A89E 00985 BTFSS F9E.4
03DA D7FE 00986 BRA 03D8
03DC 6EAD 00987 MOVWF FAD
03DE 0E0D 00988 MOVLW 0D
03E0 A89E 00989 BTFSS F9E.4
03E2 D7FE 00990 BRA 03E0
03E4 6EAD 00991 MOVWF FAD
0000 00992 ....................
0000 00993 ....................
0000 00994 .................... sleep();
03E6 0003 00995 SLEEP
0000 00996 .................... }
0000 00997 ....................
03E8 0003 0998 SLEEP
Configuration Fuses:
Word 1: C200 HS IESO FCMEN
Word 2: 1E1F BROWNOUT NOWDT BORV21 NOPUT WDT32768
Word 3: 8700 CCP2C1 PBADEN LPT1OSC MCLR
Word 4: 0081 STVREN NODEBUG NOLVP NOXINST
Word 5: C000 PROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
SYMBOL TABLE
LABEL VALUE
_RETURN_ 00000001
main.iRet 00000006
main.sBuffer 00000007
main.sGetInfo 00000027
MF_SendFrame.sData 0000002C
MF_RecvFrame.sData 0000002C
MF_RecvFrame.iLen 0000002E
MF_SendFrame.iDataLen 0000002E
MF_Kbhit.lTimeOut 0000002F
MF_SendFrame.iPtr 0000002F
MF_Debug.siTXRX 00000030
MF_Debug.sData 00000031
MF_Debug.iDataLen 00000033
MF_Debug.iPtr 00000034
PSP_DATA 00000F83
C1OUT 00000FB4
C2OUT 00000FB4
CCP_2_LOW 00000FBB
CCP_2 00000FBB
CCP_2_HIGH 00000FBC
CCP_1_LOW 00000FBE
CCP_1 00000FBE
CCP_1_HIGH 00000FBF
MF_Debug 00000130
MF_Kbhit 0000024E
MF_SendFrame 00000214
MF_RecvFrame 000002AC
main 0000030A
MEMORY USAGE
|
|
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Feb 08, 2005 8:17 am |
|
|
This is the LST CODE.
Code: |
MPASM
CCS PCH C Compiler, Version 3.218, 25972 08-Feb-05 11:14
Filename: iMFRTest.LST
ROM used: 1002 bytes (2%)
Largest free fragment is 64534
RAM used: 43 (1%) at main() level
57 (1%) worst case
Stack: 4 locations
0000 EF85 F001 00001 GOTO 030A
0000 00002 .................... #include <18F4620.h>
0000 00003 .................... //////// Standard Header file for the PIC18F4620 device ////////////////
0000 00004 .................... #device PIC18F4620
0000 00558 .................... #list
0000 00559 ....................
0000 00560 .................... #device *=16
0000 00561 .................... #device adc=8
0000 00562 .................... #case
0000 00563 .................... #use delay(clock=25000000)
0000 00564 .................... #fuses HS,NOWDT,NOLVP,PROTECT
0000 00565 .................... #opt 11
0000 00566 .................... #ignore_warnings 203,204,205,206
0000 00567 .................... #zero_ram
0000 00568 .................... #use rs232( BAUD = 115200, PARITY = N, XMIT = PIN_C6, RCV = PIN_C7, BITS = 8, STREAM = SERIAL_2 ) //, ERRORS, DISABLE_INTS )
0000 00569 ....................
0000 00570 .................... #use rs232( BAUD= 115200, PARITY = N, XMIT = PIN_C2, RCV = PIN_C1, BITS = 8, STREAM = SERIAL_MF, SAMPLE_EARLY, FORCE_SW, ERRORS )
01C8 9494 00571 BCF F94.2
01CA 948B 00572 BCF F8B.2
01CC 0E08 00573 MOVLW 08
01CE 6E01 00574 MOVWF 01
01D0 0000 00575 NOP
01D2 0000 00576 NOP
01D4 0000 00577 NOP
01D6 8E01 00578 BSF 01.7
01D8 D013 00579 BRA 0200
01DA 9E01 00580 BCF 01.7
01DC C031 F002 00581 MOVFF 31,02
01E0 3202 00582 RRCF 02,F
01E2 B0D8 00583 BTFSC FD8.0
01E4 848B 00584 BSF F8B.2
01E6 A0D8 00585 BTFSS FD8.0
01E8 948B 00586 BCF F8B.2
01EA 8C01 00587 BSF 01.6
01EC D009 00588 BRA 0200
01EE 9C01 00589 BCF 01.6
01F0 2E01 00590 DECFSZ 01,F
01F2 D7F6 00591 BRA 01E0
01F4 C002 F031 00592 MOVFF 02,31
01F8 0000 00593 NOP
01FA 0000 00594 NOP
01FC 0000 00595 NOP
01FE 848B 00596 BSF F8B.2
0200 0E0B 00597 MOVLW 0B
0202 6EE9 00598 MOVWF FE9
0204 2EE9 00599 DECFSZ FE9,F
0206 D7FE 00600 BRA 0204
0208 BE01 00601 BTFSC 01.7
020A D7E7 00602 BRA 01DA
020C BC01 00603 BTFSC 01.6
020E D7EF 00604 BRA 01EE
0210 EF23 F001 00605 GOTO 0246 (RETURN)
0262 0E08 00606 MOVLW 08
0264 6E00 00607 MOVWF 00
0266 8294 00608 BSF F94.1
0268 B282 00609 BTFSC F82.1
026A D7FE 00610 BRA 0268
026C 6A34 00611 CLRF 34
026E 9E00 00612 BCF 00.7
0270 D00E 00613 BRA 028E
0272 C034 F002 00614 MOVFF 34,02
0276 90D8 00615 BCF FD8.0
0278 B282 00616 BTFSC F82.1
027A 80D8 00617 BSF FD8.0
027C 3202 00618 RRCF 02,F
027E 8C00 00619 BSF 00.6
0280 D006 00620 BRA 028E
0282 9C00 00621 BCF 00.6
0284 2E00 00622 DECFSZ 00,F
0286 D7F7 00623 BRA 0276
0288 C002 F001 00624 MOVFF 02,01
028C D00D 00625 BRA 02A8
028E 0E0B 00626 MOVLW 0B
0290 BE00 00627 BTFSC 00.7
0292 0E03 00628 MOVLW 03
0294 6E01 00629 MOVWF 01
0296 2E01 00630 DECFSZ 01,F
0298 D7FE 00631 BRA 0296
029A 0000 00632 NOP
029C 0000 00633 NOP
029E BE00 00634 BTFSC 00.7
02A0 D7E6 00635 BRA 026E
02A2 BC00 00636 BTFSC 00.6
02A4 D7EE 00637 BRA 0282
02A6 D7E7 00638 BRA 0276
02A8 EF6E F001 00639 GOTO 02DC (RETURN)
0000 00640 ....................
0000 00641 ....................
0000 00642 ....................
0000 00643 .................... #define MF_SERIAL_PORT SERIAL_MF
0000 00644 .................... #define MF_DEBUG_PORT SERIAL_2
0000 00645 ....................
0000 00646 ....................
0000 00647 .................... #define MF_RESPONSE_TIMEOUT 25000
0000 00648 .................... #define MF_TRANSMIT_TIMEOUT 50
0000 00649 ....................
0000 00650 .................... #define MF_BUFFER_SIZE 32
0000 00651 ....................
0000 00652 ....................
0000 00653 ....................
0000 00654 .................... void MF_Debug( int1 siTXRX, char *sData, int iDataLen )
0000 00655 .................... {
0000 00656 .................... int iPtr;
0000 00657 ....................
0000 00658 .................... if ( siTXRX )
0130 5230 00659 MOVF 30,F
0132 E00B 00660 BZ 014A
0000 00661 .................... fprintf( MF_DEBUG_PORT, "%s", "TX" );
0134 6A35 00662 CLRF 35
0136 5035 00663 MOVF 35,W
0138 DF65 00664 RCALL 0004
013A 0900 00665 IORLW 00
013C E005 00666 BZ 0148
013E 2A35 00667 INCF 35,F
0140 A89E 00668 BTFSS F9E.4
0142 D7FE 00669 BRA 0140
0144 6EAD 00670 MOVWF FAD
0146 D7F7 00671 BRA 0136
0000 00672 .................... else
0148 D00A 00673 BRA 015E
0000 00674 .................... fprintf( MF_DEBUG_PORT, "%s", "RX" );
014A 6A35 00675 CLRF 35
014C 5035 00676 MOVF 35,W
014E DF64 00677 RCALL 0018
0150 0900 00678 IORLW 00
0152 E005 00679 BZ 015E
0154 2A35 00680 INCF 35,F
0156 A89E 00681 BTFSS F9E.4
0158 D7FE 00682 BRA 0156
015A 6EAD 00683 MOVWF FAD
015C D7F7 00684 BRA 014C
0000 00685 ....................
0000 00686 .................... fprintf( MF_DEBUG_PORT, "(%03U) [", iDataLen );
015E 0E28 00687 MOVLW 28
0160 A89E 00688 BTFSS F9E.4
0162 D7FE 00689 BRA 0160
0164 6EAD 00690 MOVWF FAD
0166 C033 F035 00691 MOVFF 33,35
016A 6A36 00692 CLRF 36
016C D773 00693 BRA 0054
016E 0E29 00694 MOVLW 29
0170 A89E 00695 BTFSS F9E.4
0172 D7FE 00696 BRA 0170
0174 6EAD 00697 MOVWF FAD
0176 0E20 00698 MOVLW 20
0178 A89E 00699 BTFSS F9E.4
017A D7FE 00700 BRA 0178
017C 6EAD 00701 MOVWF FAD
017E 0E5B 00702 MOVLW 5B
0180 A89E 00703 BTFSS F9E.4
0182 D7FE 00704 BRA 0180
0184 6EAD 00705 MOVWF FAD
0000 00706 ....................
0000 00707 .................... for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
0186 6A34 00708 CLRF 34
0188 5033 00709 MOVF 33,W
018A 5C34 00710 SUBWF 34,W
018C E210 00711 BC 01AE
0000 00712 .................... fprintf( MF_DEBUG_PORT, "%02X", sData[ iPtr ] );
018E 6A03 00713 CLRF 03
0190 5034 00714 MOVF 34,W
0192 2431 00715 ADDWF 31,W
0194 6EE9 00716 MOVWF FE9
0196 5032 00717 MOVF 32,W
0198 2003 00718 ADDWFC 03,W
019A 6EEA 00719 MOVWF FEA
019C CFEF F035 00720 MOVFF FEF,35
01A0 C035 F036 00721 MOVFF 35,36
01A4 0E37 00722 MOVLW 37
01A6 6E37 00723 MOVWF 37
01A8 D7A1 00724 BRA 00EC
01AA 2A34 00725 INCF 34,F
01AC D7ED 00726 BRA 0188
0000 00727 ....................
0000 00728 .................... fprintf( MF_DEBUG_PORT, "]\n\r" );
01AE 0E5D 00729 MOVLW 5D
01B0 A89E 00730 BTFSS F9E.4
01B2 D7FE 00731 BRA 01B0
01B4 6EAD 00732 MOVWF FAD
01B6 0E0A 00733 MOVLW 0A
01B8 A89E 00734 BTFSS F9E.4
01BA D7FE 00735 BRA 01B8
01BC 6EAD 00736 MOVWF FAD
01BE 0E0D 00737 MOVLW 0D
01C0 A89E 00738 BTFSS F9E.4
01C2 D7FE 00739 BRA 01C0
01C4 6EAD 00740 MOVWF FAD
0000 00741 .................... }
01C6 0C00 00742 RETLW 00
0000 00743 ....................
0000 00744 ....................
0000 00745 ....................
0000 00746 .................... void MF_Kbhit( int16 lTimeOut )
0000 00747 .................... {
0000 00748 .................... while ( !kbhit( MF_SERIAL_PORT ) && --lTimeOut );
024E A282 00749 BTFSS F82.1
0250 D007 00750 BRA 0260
0252 502F 00751 MOVF 2F,W
0254 B4D8 00752 BTFSC FD8.2
0256 0630 00753 DECF 30,F
0258 062F 00754 DECF 2F,F
025A 502F 00755 MOVF 2F,W
025C 1030 00756 IORWF 30,W
025E E1F7 00757 BNZ 024E
0000 00758 .................... }
0260 0C00 00759 RETLW 00
0000 00760 ....................
0000 00761 ....................
0000 00762 ....................
0000 00763 .................... void MF_SendFrame( char *sData, int iDataLen )
0000 00764 .................... {
0000 00765 .................... int iPtr;
0000 00766 ....................
0000 00767 .................... MF_Debug( TRUE, sData, iDataLen );
0214 0E01 00768 MOVLW 01
0216 6E30 00769 MOVWF 30
0218 C02D F032 00770 MOVFF 2D,32
021C C02C F031 00771 MOVFF 2C,31
0220 C02E F033 00772 MOVFF 2E,33
0224 DF85 00773 RCALL 0130
0000 00774 ....................
0000 00775 .................... for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
0226 6A2F 00776 CLRF 2F
0228 502E 00777 MOVF 2E,W
022A 5C2F 00778 SUBWF 2F,W
022C E20E 00779 BC 024A
0000 00780 .................... fputc( sData[ iPtr ], MF_SERIAL_PORT );
022E 6A03 00781 CLRF 03
0230 502F 00782 MOVF 2F,W
0232 242C 00783 ADDWF 2C,W
0234 6EE9 00784 MOVWF FE9
0236 502D 00785 MOVF 2D,W
0238 2003 00786 ADDWFC 03,W
023A 6EEA 00787 MOVWF FEA
023C CFEF F030 00788 MOVFF FEF,30
0240 C030 F031 00789 MOVFF 30,31
0244 D7C1 00790 BRA 01C8
0246 2A2F 00791 INCF 2F,F
0248 D7EF 00792 BRA 0228
0000 00793 .................... }
024A EFE5 F001 00794 GOTO 03CA (RETURN)
0000 00795 ....................
0000 00796 ....................
0000 00797 ....................
0000 00798 .................... int MF_RecvFrame( char *sData )
0000 00799 .................... {
0000 00800 .................... int iLen = 0;
02AC 6A2E 00801 CLRF 2E
0000 00802 ....................
0000 00803 .................... MF_Kbhit( MF_RESPONSE_TIMEOUT );
02AE 0E61 00804 MOVLW 61
02B0 6E30 00805 MOVWF 30
02B2 0EA8 00806 MOVLW A8
02B4 6E2F 00807 MOVWF 2F
02B6 DFCB 00808 RCALL 024E
0000 00809 ....................
0000 00810 .................... while ( kbhit( MF_SERIAL_PORT ) && iLen < MF_BUFFER_SIZE )
0000 00811 .................... {
02B8 B282 00812 BTFSC F82.1
02BA D01B 00813 BRA 02F2
02BC 502E 00814 MOVF 2E,W
02BE 081F 00815 SUBLW 1F
02C0 E318 00816 BNC 02F2
0000 00817 .................... sData[ iLen++ ] = fgetc( MF_SERIAL_PORT );
02C2 502E 00818 MOVF 2E,W
02C4 2A2E 00819 INCF 2E,F
02C6 6A03 00820 CLRF 03
02C8 242C 00821 ADDWF 2C,W
02CA 6EE9 00822 MOVWF FE9
02CC 502D 00823 MOVF 2D,W
02CE 2003 00824 ADDWFC 03,W
02D0 6EEA 00825 MOVWF FEA
02D2 CFEA F033 00826 MOVFF FEA,33
02D6 CFE9 F032 00827 MOVFF FE9,32
02DA D7C3 00828 BRA 0262
02DC C033 FFEA 00829 MOVFF 33,FEA
02E0 C032 FFE9 00830 MOVFF 32,FE9
02E4 C001 FFEF 00831 MOVFF 01,FEF
0000 00832 .................... MF_Kbhit( MF_TRANSMIT_TIMEOUT );
02E8 6A30 00833 CLRF 30
02EA 0E32 00834 MOVLW 32
02EC 6E2F 00835 MOVWF 2F
02EE DFAF 00836 RCALL 024E
0000 00837 .................... }
02F0 D7E3 00838 BRA 02B8
0000 00839 ....................
0000 00840 .................... MF_Debug( FALSE, sData, iLen );
02F2 6A30 00841 CLRF 30
02F4 C02D F032 00842 MOVFF 2D,32
02F8 C02C F031 00843 MOVFF 2C,31
02FC C02E F033 00844 MOVFF 2E,33
0300 DF17 00845 RCALL 0130
0000 00846 ....................
0000 00847 .................... return iLen;
0302 C02E F001 00848 MOVFF 2E,01
0000 00849 .................... }
0306 EFE9 F001 00850 GOTO 03D2 (RETURN)
0000 00851 ....................
0000 00852 ....................
0000 00853 ....................
0000 00854 .................... void main()
0000 00855 .................... {
030A 6AF8 00856 CLRF FF8
030C 9ED0 00857 BCF FD0.7
030E 0EFE 00858 MOVLW FE
0310 6E00 00859 MOVWF 00
0312 0E10 00860 MOVLW 10
0314 6E01 00861 MOVWF 01
0316 6AEA 00862 CLRF FEA
0318 0E02 00863 MOVLW 02
031A 6EE9 00864 MOVWF FE9
031C 6AEF 00865 CLRF FEF
031E 2AE9 00866 INCF FE9,F
0320 B4D8 00867 BTFSC FD8.2
0322 2AEA 00868 INCF FEA,F
0324 2E00 00869 DECFSZ 00,F
0326 D7FA 00870 BRA 031C
0328 2E01 00871 DECFSZ 01,F
032A D7F8 00872 BRA 031C
032C 6AEA 00873 CLRF FEA
032E 6AE9 00874 CLRF FE9
0330 50C1 00875 MOVF FC1,W
0332 0BC0 00876 ANDLW C0
0334 090F 00877 IORLW 0F
0336 6EC1 00878 MOVWF FC1
0338 0E07 00879 MOVLW 07
033A 6EB4 00880 MOVWF FB4
033C 50B4 00881 MOVF FB4,W
033E 9CA1 00882 BCF FA1.6
0340 86B8 00883 BSF FB8.3
0342 0E35 00884 MOVLW 35
0344 6EAF 00885 MOVWF FAF
0346 0E26 00886 MOVLW 26
0348 6EAC 00887 MOVWF FAC
034A 0E90 00888 MOVLW 90
034C 6EAB 00889 MOVWF FAB
034E 9494 00890 BCF F94.2
0350 848B 00891 BSF F8B.2
0000 00892 .................... //
0000 00893 .................... // Defino variables locales
0000 00894 .................... //
0000 00895 .................... int iRet;
0000 00896 .................... char sBuffer[ MF_BUFFER_SIZE ];
0000 00897 .................... char sGetInfo[ 5 ] = { 0x16, 0x00, 0x4F, 0x00, 0x4F };
0352 0E16 00898 MOVLW 16
0354 6E27 00899 MOVWF 27
0356 6A28 00900 CLRF 28
0358 0E4F 00901 MOVLW 4F
035A 6E29 00902 MOVWF 29
035C 6A2A 00903 CLRF 2A
035E 6E2B 00904 MOVWF 2B
0000 00905 ....................
0000 00906 ....................
0000 00907 .................... setup_adc_ports(NO_ANALOGS);
0360 50C1 00908 MOVF FC1,W
0362 0BC0 00909 ANDLW C0
0364 090F 00910 IORLW 0F
0366 6EC1 00911 MOVWF FC1
0000 00912 .................... setup_adc(ADC_OFF);
0368 90C2 00913 BCF FC2.0
0000 00914 .................... setup_ccp1(CCP_OFF);
036A 0EB7 00915 MOVLW B7
036C 16B1 00916 ANDWF FB1,F
036E 8494 00917 BSF F94.2
0370 6ABD 00918 CLRF FBD
0372 6ABD 00919 CLRF FBD
0000 00920 .................... setup_ccp2(CCP_OFF);
0374 16B1 00921 ANDWF FB1,F
0376 8294 00922 BSF F94.1
0378 6ABA 00923 CLRF FBA
037A 6ABA 00924 CLRF FBA
037C 6AB6 00925 CLRF FB6
037E 6AB7 00926 CLRF FB7
0000 00927 .................... setup_comparator(NC_NC_NC_NC);
0380 0E07 00928 MOVLW 07
0382 6EB4 00929 MOVWF FB4
0384 5092 00930 MOVF F92,W
0386 0E14 00931 MOVLW 14
0388 6E00 00932 MOVWF 00
038A 2E00 00933 DECFSZ 00,F
038C D7FE 00934 BRA 038A
038E 0000 00935 NOP
0390 50B4 00936 MOVF FB4,W
0392 9CA1 00937 BCF FA1.6
0000 00938 .................... setup_vref(FALSE);
0394 6AB5 00939 CLRF FB5
0000 00940 .................... setup_psp(PSP_DISABLED);
0396 9896 00941 BCF F96.4
0000 00942 .................... setup_spi(FALSE);
0398 9AC6 00943 BCF FC6.5
039A 9A94 00944 BCF F94.5
039C 8894 00945 BSF F94.4
039E 9694 00946 BCF F94.3
03A0 0E00 00947 MOVLW 00
03A2 6EC6 00948 MOVWF FC6
03A4 6EC7 00949 MOVWF FC7
0000 00950 .................... setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
03A6 90D1 00951 BCF FD1.0
03A8 0E80 00952 MOVLW 80
03AA 6ED5 00953 MOVWF FD5
0000 00954 .................... setup_timer_1(T1_DISABLED);
03AC 6ACD 00955 CLRF FCD
0000 00956 .................... setup_timer_2(T2_DISABLED,0,1);
03AE 0E00 00957 MOVLW 00
03B0 6ECA 00958 MOVWF FCA
03B2 0E00 00959 MOVLW 00
03B4 6ECB 00960 MOVWF FCB
0000 00961 .................... disable_interrupts( GLOBAL );
03B6 9CF2 00962 BCF FF2.6
03B8 9EF2 00963 BCF FF2.7
03BA BEF2 00964 BTFSC FF2.7
03BC D7FD 00965 BRA 03B8
0000 00966 ....................
0000 00967 ....................
0000 00968 .................... MF_SendFrame( sGetInfo, 5 );
03BE 6A2D 00969 CLRF 2D
03C0 0E27 00970 MOVLW 27
03C2 6E2C 00971 MOVWF 2C
03C4 0E05 00972 MOVLW 05
03C6 6E2E 00973 MOVWF 2E
03C8 D725 00974 BRA 0214
0000 00975 .................... iRet = MF_RecvFrame( sBuffer );
03CA 6A2D 00976 CLRF 2D
03CC 0E07 00977 MOVLW 07
03CE 6E2C 00978 MOVWF 2C
03D0 D76D 00979 BRA 02AC
03D2 C001 F006 00980 MOVFF 01,06
0000 00981 ....................
0000 00982 ....................
0000 00983 .................... fprintf( SERIAL_2, "\n\r" );
03D6 0E0A 00984 MOVLW 0A
03D8 A89E 00985 BTFSS F9E.4
03DA D7FE 00986 BRA 03D8
03DC 6EAD 00987 MOVWF FAD
03DE 0E0D 00988 MOVLW 0D
03E0 A89E 00989 BTFSS F9E.4
03E2 D7FE 00990 BRA 03E0
03E4 6EAD 00991 MOVWF FAD
0000 00992 ....................
0000 00993 ....................
0000 00994 .................... sleep();
03E6 0003 00995 SLEEP
0000 00996 .................... }
0000 00997 ....................
03E8 0003 0998 SLEEP
Configuration Fuses:
Word 1: C200 HS IESO FCMEN
Word 2: 1E1F BROWNOUT NOWDT BORV21 NOPUT WDT32768
Word 3: 8700 CCP2C1 PBADEN LPT1OSC MCLR
Word 4: 0081 STVREN NODEBUG NOLVP NOXINST
Word 5: C000 PROTECT NOCPD NOCPB
Word 6: E00F NOWRT NOWRTD NOWRTC NOWRTB
Word 7: 400F NOEBTR NOEBTRB
SYMBOL TABLE
LABEL VALUE
_RETURN_ 00000001
main.iRet 00000006
main.sBuffer 00000007
main.sGetInfo 00000027
MF_SendFrame.sData 0000002C
MF_RecvFrame.sData 0000002C
MF_RecvFrame.iLen 0000002E
MF_SendFrame.iDataLen 0000002E
MF_Kbhit.lTimeOut 0000002F
MF_SendFrame.iPtr 0000002F
MF_Debug.siTXRX 00000030
MF_Debug.sData 00000031
MF_Debug.iDataLen 00000033
MF_Debug.iPtr 00000034
PSP_DATA 00000F83
C1OUT 00000FB4
C2OUT 00000FB4
CCP_2_LOW 00000FBB
CCP_2 00000FBB
CCP_2_HIGH 00000FBC
CCP_1_LOW 00000FBE
CCP_1 00000FBE
CCP_1_HIGH 00000FBF
MF_Debug 00000130
MF_Kbhit 0000024E
MF_SendFrame 00000214
MF_RecvFrame 000002AC
main 0000030A
MEMORY USAGE
|
|
|
|
cfernandez
Joined: 18 Oct 2003 Posts: 145
|
|
Posted: Tue Feb 08, 2005 8:23 am |
|
|
This is the LST CODE.
Code: |
#include <18F4620.h>
#device *=16
#device adc=8
#case
#use delay(clock=25000000)
#fuses HS,NOWDT,NOLVP,PROTECT
#opt 11
#ignore_warnings 203,204,205,206
#zero_ram
#use rs232( BAUD = 115200, PARITY = N, XMIT = PIN_C6, RCV = PIN_C7, BITS = 8, STREAM = SERIAL_2 ) //, ERRORS, DISABLE_INTS )
#use rs232( BAUD= 115200, PARITY = N, XMIT = PIN_C2, RCV = PIN_C1, BITS = 8, STREAM = SERIAL_MF, SAMPLE_EARLY, FORCE_SW, ERRORS )
#define MF_SERIAL_PORT SERIAL_MF
#define MF_DEBUG_PORT SERIAL_2
#define MF_RESPONSE_TIMEOUT 25000
#define MF_TRANSMIT_TIMEOUT 50
#define MF_BUFFER_SIZE 32
void MF_Debug( int1 siTXRX, char *sData, int iDataLen )
{
int iPtr;
if ( siTXRX )
fprintf( MF_DEBUG_PORT, "%s", "TX" );
else
fprintf( MF_DEBUG_PORT, "%s", "RX" );
fprintf( MF_DEBUG_PORT, "(%03U) [", iDataLen );
for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
fprintf( MF_DEBUG_PORT, "%02X", sData[ iPtr ] );
fprintf( MF_DEBUG_PORT, "]\n\r" );
}
void MF_Kbhit( int16 lTimeOut )
{
while ( !kbhit( MF_SERIAL_PORT ) && --lTimeOut );
}
void MF_SendFrame( char *sData, int iDataLen )
{
int iPtr;
MF_Debug( TRUE, sData, iDataLen );
for ( iPtr = 0 ; iPtr < iDataLen ; iPtr++ )
fputc( sData[ iPtr ], MF_SERIAL_PORT );
}
int MF_RecvFrame( char *sData )
{
int iLen = 0;
MF_Kbhit( MF_RESPONSE_TIMEOUT );
while ( kbhit( MF_SERIAL_PORT ) && iLen < MF_BUFFER_SIZE )
{
sData[ iLen++ ] = fgetc( MF_SERIAL_PORT );
MF_Kbhit( MF_TRANSMIT_TIMEOUT );
}
MF_Debug( FALSE, sData, iLen );
return iLen;
}
void main()
{
//
// Defino variables locales
//
int iRet;
char sBuffer[ MF_BUFFER_SIZE ];
char sGetInfo[ 5 ] = { 0x16, 0x00, 0x4F, 0x00, 0x4F };
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
disable_interrupts( GLOBAL );
MF_SendFrame( sGetInfo, 5 );
iRet = MF_RecvFrame( sBuffer );
fprintf( SERIAL_2, "\n\r" );
sleep();
}
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|