Hi, I got the syntax.
.include "filename". Thanks for your help. Thanks, Prashanthi --- "Gudjon I. Gudjonsson" <[EMAIL PROTECTED]> wrote: > Hi > I made the following c-code: > > // Initialize Module 0 in capture mode > CCAPM0=0x21; // Capture positive edge first > // for measuring pulse width > flag_0=0; > n=1; > AUXR1=0x01; > meas_end=res_dph_addr[n]; > _asm > mov dph, _meas_end > mov dpl, #0 > _endasm; > AUXR1=0; > meas_end=res_dph_addr[n+1]; > > and in the assembler code it looks like this: > > mov _CCAPM0,#0x21 > ; measure_pulses_03.c:116: flag_0=0; > clr _flag_0 > ; measure_pulses_03.c:118: AUXR1=0x01; > mov _AUXR1,#0x01 > ; measure_pulses_03.c:119: meas_end=res_dph_addr[n]; > ; measure_pulses_03.c:123: _endasm; > > mov dph, #_meas_end > mov dpl, #0 > > ; measure_pulses_03.c:124: AUXR1=0; > mov _AUXR1,#0x00 > ; measure_pulses_03.c:125: > meas_end=res_dph_addr[n+1]; > mov dptr,#(_res_dph_addr + 0x0002) > clr a > movc a,@a+dptr > mov _meas_end,a > > The variable meas_end is not set until after the > _asm block but I need it > before the block. The obvious solution is to set DPL > and DPH in C :) > But I might need to do use inline assembler some > other time and I don't want > my variables to be optimised away. > Can anyone explain this behaviour? > > The other question > > I have spent the last two days on making a function > that enables interrupts > from PCA to make measurements. It should then wait > for a keyboard input to > finish the measurement. > EC = 1; > EA = 1; // Enable global interrupt > CR = 1; > ggetchar(); > CR = 0; // Turn PCA timer off > IE = 0x0; // Disable all interrupt > where the functions are defined below. The problem > is that the program always > jumps over the ggetchar() function without waiting > and even if I only put a > while(1) statement instead of the ggetchar() > function. > I guess this means tedious debugging but if it is > some simple misunderstanding > I would be very happy :) > > unsigned char ggetchar() > { > while(P2==0xFF); > usleep(30000); > return P2; > } > > > void usleep(unsigned int j) > { > unsigned int i; > for ( i=0;i<=j;i++); > } > > Thanks > Gudjon > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 > express and take > control of your XML. No limits. Just data. Click to > get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user