|
|
View previous topic :: View next topic |
Author |
Message |
KONGXH Guest
|
3.249 have bug ? |
Posted: Sat Jun 24, 2006 7:09 pm |
|
|
device is pic18f458
struct StCommDataA
{
BOOLEAN m_Modal; //
BOOLEAN m_IsOpen; //
BOOLEAN m_IsOn; //
BOOLEAN m_IsAutoRun; //
int8 m_CommErr :2 ; //
BOOLEAN m_IsRunEnable ; //
BOOLEAN m_IsAutoRunCommad; //
}m_sb_sta[16],m_sb_sta_t;
.................... if(m_sb_sta[i].m_CommErr==3)SendData[3]=SendData[3]| bitset[i];
2094: CLRF x1C
2096: MOVFF 119,11B
209A: MOVLW BB
209C: ADDWF x19,W
209E: MOVWF FE9
20A0: MOVLW 00
20A2: ADDWFC x1C,W
20A4: MOVWF FEA
20A6: MOVFF FEF,00
20AA: SWAPF 00,W ???
20AC: ANDLW 03 ???
20AE: BNZ 20CC ???
20B0: CLRF 03
20B2: MOVF x19,W
20B4: MOVFF FF2,11B
20B8: BCF FF2.7
20BA: MOVLB 0
20BC: CALL 0302
20C0: MOVLB 1
20C2: BTFSC x1B.7
20C4: BSF FF2.7
20C6: MOVLB 0
20C8: IORWF x89,F
20CA: MOVLB 1
.................... if(m_sb_sta[ii].m_CommErr<3)
221A: MOVLB 1
221C: CLRF x1A
221E: MOVFF 118,119
2222: MOVLW BB
2224: ADDWF x18,W
2226: MOVWF FE9
2228: MOVLW 00
222A: ADDWFC x1A,W
222C: MOVWF FEA
222E: MOVFF FEF,00
2232: SWAPF 00,W ????
2234: ANDLW 03 ????
2236: MOVLW 03 ????
2238: ANDLW 03 ????
223A: SUBWF 03,W ????
223C: BZ 225E
223E: BNC 225E
.................... {m_sb_sta[ii].m_CommErr++;};
2240: CLRF x1A
2242: MOVLW BB
2244: ADDWF x18,W
2246: MOVWF FE9
2248: MOVLW 00
224A: ADDWFC x1A,W
224C: MOVWF FEA
224E: MOVF FEF,W
2250: ADDLW 10
2252: ANDLW 30
2254: MOVWF 00
2256: MOVLW CF
2258: ANDWF FEF,W
225A: IORWF 00,W
225C: MOVWF FEF
225E: MOVLB 0 |
|
|
Ttelmah Guest
|
|
Posted: Sun Jun 25, 2006 4:07 am |
|
|
You don't make it easy for us. We are not telepathic. We have no knowledge of where the variables involved in your assembler are stored. There is a visible problem, but without knowledge of the locations, it is impossible to track exactly what is happening.
However, that comment made, the compiler is using quite a neat 'trick' to access your value. It uses the indirect addressing capabilty to access the 'byte' containing the value, and then copies this into scratch memory at address '0'. It then uses the 'swapf' instruction, which swaps the nibbles in a value, to move the top nibble in the byte into the bottom. This then gives the m_CommErr value, occupying the bottom two bits of the W register. This is 'right', and the first couple of '???' lines correspond to this.
It then masks the required two bits (ANDLW 03). Again right.
However from this point, the tests, immediately appear to go wrong. There ought to be a subwf, between the 'and', and the jump on the first test. The code is behaving as if the compiler things that the 'and' operation, will set the zero flag for equality, rather than for 'zero'...
You can 'bodge' round the errors, like this:
if((m_sb_sta[i].m_CommErr&3)==3)SendData[3]=SendData[3]| bitset[i];
Adding the mask, makes the test work correctly. The same applies for the second test.
Add the masks to get your code working, and report the error to CCS.
Best Wishes |
|
|
|
|
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
|