Gudjon I. Gudjonsson 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];
>
[snip]
>
> The variable meas_end is not set until after the _asm block but I need it
> before the block. Can anyone explain this behaviour?
>

Have you tried declaring meas_end as volatile?

> 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 :)
>

Can you provide the asm output?

Dan.

-------------------------------------------------------------------------
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

Reply via email to