This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

_nop_() does not work

Hi forum!
I need a delay in a programm but _nop_() seems not to work. Thus I wrote the following code in the main function where x is an IO pin:

while(1)
{
x = 1;
_nop_();
x = 0;
_nop_();
}

Only the second _nop_() causes a delay but not the first one. µVsioin2 is used. Can anybody help me?

Thanks Fabian

Parents
  • Sorry, Erik.
    Hope this is the right one. I'm new to this stuff.

    C166 COMPILER V4.27, SLREGELUNG                                                            09/07/2005 16:28:48 PAGE 1
    
    
    C166 COMPILER V4.27, COMPILATION OF MODULE SLREGELUNG
    OBJECT MODULE PLACED IN slregelung.OBJ
    COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE slregelung.c LARGE BROWSE NODPPSAVE SAVEUSR REORDER MOD167 DEBUG
    
     stmt lvl     source
    
        1         #pragma large
        2         #pragma MOD167 FIX167
        3
        4         #include "intrins.h"
        5         #include "regst10F269.h"
        6         #include "absacc.h"
        7         #include "math.h"
        8
        9         sbit Testpin = P3^7;
       10
       11         #include "stdio.h"
       12
       13         void main(void)
       14         {
       15  1              DP3 = 0x00C0;
       16  1
       17  1              while(1)
       18  1              {
       19  2                      Testpin = 1;
       20  2                      _nop_();
       21  2                      Testpin = 0;
       22  2                      _nop_();
       23  2              }
       24  1      }
       25         //  ---------------------------------- E N D E ---------------------------------------
       26
       27
    
    
    MODULE INFORMATION:   INITIALIZED  UNINITIALIZED
      CODE SIZE        =          14     --------
      NEAR-CONST SIZE  =    --------     --------
      FAR-CONST SIZE   =    --------     --------
      HUGE-CONST SIZE  =    --------     --------
      XHUGE-CONST SIZE =    --------     --------
      NEAR-DATA SIZE   =    --------     --------
      FAR-DATA SIZE    =    --------     --------
      XHUGE-DATA SIZE  =    --------     --------
      IDATA-DATA SIZE  =    --------     --------
      SDATA-DATA SIZE  =    --------     --------
      BDATA-DATA SIZE  =    --------     --------
      HUGE-DATA SIZE   =    --------     --------
      BIT SIZE         =    --------     --------
      INIT'L SIZE      =    --------     --------
    END OF MODULE INFORMATION.
    
    
    C166 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
    

Reply
  • Sorry, Erik.
    Hope this is the right one. I'm new to this stuff.

    C166 COMPILER V4.27, SLREGELUNG                                                            09/07/2005 16:28:48 PAGE 1
    
    
    C166 COMPILER V4.27, COMPILATION OF MODULE SLREGELUNG
    OBJECT MODULE PLACED IN slregelung.OBJ
    COMPILER INVOKED BY: C:\Keil\C166\BIN\C166.EXE slregelung.c LARGE BROWSE NODPPSAVE SAVEUSR REORDER MOD167 DEBUG
    
     stmt lvl     source
    
        1         #pragma large
        2         #pragma MOD167 FIX167
        3
        4         #include "intrins.h"
        5         #include "regst10F269.h"
        6         #include "absacc.h"
        7         #include "math.h"
        8
        9         sbit Testpin = P3^7;
       10
       11         #include "stdio.h"
       12
       13         void main(void)
       14         {
       15  1              DP3 = 0x00C0;
       16  1
       17  1              while(1)
       18  1              {
       19  2                      Testpin = 1;
       20  2                      _nop_();
       21  2                      Testpin = 0;
       22  2                      _nop_();
       23  2              }
       24  1      }
       25         //  ---------------------------------- E N D E ---------------------------------------
       26
       27
    
    
    MODULE INFORMATION:   INITIALIZED  UNINITIALIZED
      CODE SIZE        =          14     --------
      NEAR-CONST SIZE  =    --------     --------
      FAR-CONST SIZE   =    --------     --------
      HUGE-CONST SIZE  =    --------     --------
      XHUGE-CONST SIZE =    --------     --------
      NEAR-DATA SIZE   =    --------     --------
      FAR-DATA SIZE    =    --------     --------
      XHUGE-DATA SIZE  =    --------     --------
      IDATA-DATA SIZE  =    --------     --------
      SDATA-DATA SIZE  =    --------     --------
      BDATA-DATA SIZE  =    --------     --------
      HUGE-DATA SIZE   =    --------     --------
      BIT SIZE         =    --------     --------
      INIT'L SIZE      =    --------     --------
    END OF MODULE INFORMATION.
    
    
    C166 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
    

Children