Hi, Alain Portal:

Thank you so much... I didn't make my program work yet, but I tested your delay4NOP()() already, and yes, the program compiled successfully. 

For now, the testing code is a as simple as:

#include <8051.h>
#define Nop() \
    __asm     \
        nop   \
    __endasm  \

#define delay4NOP() \
    __asm     \
        nop   \
        nop   \
        nop   \
        nop   \
    __endasm  \

void main(void )
 {
    uchar m;
     
    P0=0xFF;
    P1=0xFF;
    delay4NOP();
}



Thank you Alain...Testing going on...


Best Regards
Pei





On Sun, Jun 9, 2013 at 1:34 AM, Alain Portal <alain.portal@free.fr> wrote:
Le samedi 8 juin 2013 12:19:18 Alain Portal a écrit :
> Hi,
>
> Le samedi 8 juin 2013 17:28:33 JIA Pei a écrit :
> > Hi, all:
> >
> > Since a lot of the testing codes were written under Windows with Keil C51,
> > it's seriously a big problem for me to recompile everything under Linux
> > using sdcc.
> >
> > Again, the following line is in one of my codes, which seems to declare a
> > function delayNOP() which pauses 4 CPU clocks.
> >
> > *#define delayNOP(); {_nop_();_nop_();_nop_();_nop_();};*
> >
> > However, what is the function equal to Keil C51 *_nop_()* in *sdcc* ?
> >
> > I don't want to re-write the code, but just simply modify it and make it
> > work after flash it onto my board. So, can anybody help me please?
>
> I don't remember if a such function exists in the sdcc libraries, but you can write your own as is:
>
> #define Nop() \
>     __asm     \
>         nop   \
>     __endasm  \
>
> #define delay4NOP() \
>     __asm     \
>         nop   \
>         nop   \
>         nop   \
>         nop   \
>     __endasm  \

Does it help?

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user



--

Pei JIA

Email: jp4work@gmail.com
cell:    +1 604-362-5816

Welcome to Vision Open
http://www.visionopen.com