|
|
View previous topic :: View next topic |
Author |
Message |
Bomba
Joined: 09 Dec 2003 Posts: 13
|
CCS generated assembler |
Posted: Fri Jan 23, 2004 9:16 am |
|
|
See the second code, and tell my why pass at line 0009 without line 0008, compare it with the 1º. And other question is, second code in line 12: SET_TRIS_B( 0x0 ); do nothing (only line 0007)...
******* 1º
5: #use fast_io(B)
6:
7: void main()
8: {
000004 184 CLRF 0x4
000005 301F MOVLW 0x1f
000006 583 ANDWF 0x3, F
9: int Aux1,Aux2;
10: short Aux3;
11:
12: //SET_TRIS_B( 0x0 );
13:
14: //OUTPUT_A(0x00);
15: Aux3=1;
000007 1411 BSF 0x11, 0
16: Aux1 = input_b();
000008 806 MOVF 0x6, W
000009 08F MOVWF 0xf
****** end 1º
******2º
5: #use fast_io(B)
6:
7: void main()
8: {
000004 184 CLRF 0x4
000005 301F MOVLW 0x1f
000006 583 ANDWF 0x3, F
9: int Aux1,Aux2;
10: short Aux3;
11:
12: SET_TRIS_B( 0x0 );
000007 3000 MOVLW 0
13:
14: //OUTPUT_A(0x00);
15: Aux3=1;
000009 1411 BSF 0x11, 0
16: Aux1 = input_b();
00000A 806 MOVF 0x6, W
00000B 08F MOVWF 0xf
*****end 2º
See that:
*********3º
.................... #use fast_io(B)
....................
.................... void main()
.................... {
0004: CLRF 04
0005: MOVLW 1F
0006: ANDWF 03,F
.................... int Aux1,Aux2;
.................... short Aux3;
....................
.................... SET_TRIS_B( 0xFF );
0007: MOVLW FF
0008: TRIS 6
....................
.................... OUTPUT_A(0x00);
0009: MOVLW 00
000A: BSF 03.5
000B: MOVWF 05
000C: BCF 03.5
000D: CLRF 05
.................... Aux3=1;
000E: BSF 11.0
.................... Aux1 = input_b();
000F: MOVF 06,W
0010: MOVWF 0F
*******end 3º
This code is compiled into ccs ide, the above (1º and 2º) was compiled into mplab ide, the mplab ide discard the tris instruction. Can MPLAB IDE use the tris instruction?. Or I must to disable the tris option into ccs.
Thanks in advance |
|
|
Bomba
Joined: 09 Dec 2003 Posts: 13
|
correlation betwen HEX file |
Posted: Fri Jan 23, 2004 10:09 am |
|
|
I correlated the HEX file generated by MPLABIDE and CCSIDE, and these files are equal, but the visualization omits the tris instruction into MPLAB.
Or I’m doing something wrong.
Thanks |
|
|
Ttelmah Guest
|
Re: CCS generated assembler |
Posted: Fri Jan 23, 2004 10:21 am |
|
|
Bomba wrote: | See the second code, and tell my why pass at line 0009 without line 0008, compare it with the 1º. And other question is, second code in line 12: SET_TRIS_B( 0x0 ); do nothing (only line 0007)...
******* 1º
5: #use fast_io(B)
6:
7: void main()
8: {
000004 184 CLRF 0x4
000005 301F MOVLW 0x1f
000006 583 ANDWF 0x3, F
9: int Aux1,Aux2;
10: short Aux3;
11:
12: //SET_TRIS_B( 0x0 );
13:
14: //OUTPUT_A(0x00);
15: Aux3=1;
000007 1411 BSF 0x11, 0
16: Aux1 = input_b();
000008 806 MOVF 0x6, W
000009 08F MOVWF 0xf
****** end 1º
******2º
5: #use fast_io(B)
6:
7: void main()
8: {
000004 184 CLRF 0x4
000005 301F MOVLW 0x1f
000006 583 ANDWF 0x3, F
9: int Aux1,Aux2;
10: short Aux3;
11:
12: SET_TRIS_B( 0x0 );
000007 3000 MOVLW 0
13:
14: //OUTPUT_A(0x00);
15: Aux3=1;
000009 1411 BSF 0x11, 0
16: Aux1 = input_b();
00000A 806 MOVF 0x6, W
00000B 08F MOVWF 0xf
*****end 2º
See that:
*********3º
.................... #use fast_io(B)
....................
.................... void main()
.................... {
0004: CLRF 04
0005: MOVLW 1F
0006: ANDWF 03,F
.................... int Aux1,Aux2;
.................... short Aux3;
....................
.................... SET_TRIS_B( 0xFF );
0007: MOVLW FF
0008: TRIS 6
....................
.................... OUTPUT_A(0x00);
0009: MOVLW 00
000A: BSF 03.5
000B: MOVWF 05
000C: BCF 03.5
000D: CLRF 05
.................... Aux3=1;
000E: BSF 11.0
.................... Aux1 = input_b();
000F: MOVF 06,W
0010: MOVWF 0F
*******end 3º
This code is compiled into ccs ide, the above (1º and 2º) was compiled into mplab ide, the mplab ide discard the tris instruction. Can MPLAB IDE use the tris instruction?. Or I must to disable the tris option into ccs.
Thanks in advance |
What do you think line 9 should do?. The compiler, does not 'clear' a memory location, unless you use static variables, or force an initialisation (int Aux1=0,Aux2=0;)
Hence the statement will generate no code, merely telling the compiler to assign a storage location to be used.
Are you sure the IDE 'discards' the TRIS, or does it just not display the code?. Unfortunately the TRIS instruction, is obsolete, but CCS keep using it. The instruction still works, but is not a 'recognised' disassembly value in some enviroments. If you look carefully at the addresses shown, the IDE, is showing that there is an instruction there (the address moves forward by 2), but just doesn't show disassembly for the instruction.
If you look at the contents of the TRIS register, before the instructions, and afterwards, you'll find it is being updated.
Best Wishes |
|
|
Guest
|
|
Posted: Fri Jan 23, 2004 6:37 pm |
|
|
Hi Ttelmah
You have reason, I compare the HEX file generated by the MPLABIDE and CCSIDE, and they are identical.
Thank you!! |
|
|
|
|
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
|