|
|
View previous topic :: View next topic |
Author |
Message |
Jimm ng Guest
|
compiler problem? |
Posted: Wed Jul 16, 2008 9:53 am |
|
|
hi,
i got this code
Code: |
.................... g_sSysConfigData.gps_log.distance = SYSDATA_GPS_LOG_DISTANCE;
00986: CLRF x99
00988: MOVWF x98
....................
.................... /* system identifications and calibration */
.................... // box ID
.................... for(u8Index = 0; u8Index < SYSDATA_BOX_ID_LEN; u8Index++)
0098A: MOVLB 4
0098C: CLRF xA5
0098E: MOVLB 4
00990: MOVF xA5,W
00992: SUBLW 06
00994: BTFSS FD8.0
00996: GOTO 09DA
0099A: MOVLB 0
.................... {
.................... g_sSysConfigData.manufacture.boxid[u8Index] = SYSDATA_BOX_ID[u8Index];
0099C: CLRF 03
0099E: MOVLB 4
009A0: MOVF xA5,W
009A2: ADDLW 07
009A4: MOVWF 01
009A6: MOVLW 00
009A8: ADDWFC 03,F
009AA: MOVF 01,W
009AC: ADDLW 7E
009AE: MOVWF FE9
009B0: MOVLW 00
009B2: ADDWFC 03,W
009B4: MOVWF FEA
009B6: CLRF 03
009B8: MOVF xA5,W
009BA: MOVFF FF2,4A8
009BE: BCF FF2.7
009C0: MOVLB 0
009C2: CALL 00BE
009C6: MOVLB 4
009C8: BTFSC xA8.7
009CA: BSF FF2.7
009CC: MOVWF FEF
009CE: MOVLB 0
.................... }
009D0: MOVLB 4
009D2: INCF xA5,F
009D4: GOTO 098E
009D8: MOVLB 0
.................... g_sSysConfigData.manufacture.calib_status = SYSDATA_VSS_NO_CALIB;
009DA: CLRF x7E
.................... g_sSysConfigData.manufacture.tracking_enable = FALSE;
009DC: CLRF x93
.................... g_sSysConfigData.manufacture.input_map = 0;
009DE: CLRF x94
.................... //g_sSysConfigData.manufacture.input_map = 0x1E;
|
when the above code excecution, somehow the g_sSysConfigData.manufacture.calib_status, g_sSysConfigData.manufacture.tracking_enable and g_sSysConfigData.manufacture.input_map don't get the correct initialized values, but the g_sSysConfigData.manufacture.boxid got the correct initialized values.
I used PCWH 4.033 and pic 18F720
the symbol is located 07E-109 g_sSysConfigData
any idea what is the cause of this problem?
Thank you |
|
|
Ttelmah Guest
|
|
Posted: Wed Jul 16, 2008 10:09 am |
|
|
What you post, _does_ correctly initialise the locations you mention. It is only the very last few lines of the code, but:
Code: |
009D8: MOVLB 0
//Selects '0xx' as the addresses to be used.
.................... g_sSysConfigData.manufacture.calib_status = SYSDATA_VSS_NO_CALIB;
009DA: CLRF x7E
//Clears address 07E - depends what you have //'SSSDATA_VSS_NO_CALIB' defined as.
.................... g_sSysConfigData.manufacture.tracking_enable = FALSE;
009DC: CLRF x93
//Clears address 093 - since 'false' in C is a '0' this is correct
.................... g_sSysConfigData.manufacture.input_map = 0;
009DE: CLRF x94
//Clears address 094
|
So the code is doing exactly what you have told it to do...
Comments though. 4.033, is right on the 'cusp' of when V4 compilers started to work reasonably. I'd be 'wary' of using it.
The actual fault is probably somewhere else. Some pointer arithmetic 'walking' over this area of memory, this code not actually being called, etc. etc..
Add a debug check, right in front of the last few initialisations. Output the values. Do the same immediately afterwards.
Then, when you find the locations are initialised, see where they are changed by something else.
Best Wishes |
|
|
Jimmy Ng Guest
|
|
Posted: Wed Jul 16, 2008 7:14 pm |
|
|
hi Ttelmah,
I did single step through the code, and I exammed the variable right away after the single step.
Jim |
|
|
Guest
|
|
Posted: Thu Jul 17, 2008 10:00 am |
|
|
Seriously, the code is doing what it should.
1) Are you confident in the hardware you used to single step the code. Simulator faults are not uncommon.
2) Do you have anything _else_ that could affect the locations (interrupt routine)?.
3) Add a debugging line immediately after the writes, printing out the values. Disable interrupts before. Run this on a real chip. Does it do the same?.
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
|