From: Jean-Paul <tch...@fr...> - 2004-04-07 20:38:33
|
Hello, Instead of > P5 &=3D (~0x04); and then > P5 |=3D 4 ; //led off you're better off with P5_2 ^=3D 1; With the XOR, you are sure that the port pin is actually toggled, while you have to write the code for delay and toggling just once ;-) If _i _ has to remain < 1000, it could as well be an int. On the other hand, as you just want to spend some time... You can avoid the last line of your batch by simply adding: -o hello390.hex in the parameters of your second call to sdcc (linking). That's for sure. As to your problem, I don't know. Are you sure that the=20 code is exactly as it is written here? Jean-Paul [Si votre adresse est ce que je suppose, on pourrait communiquer en=20 fran=E7ais, mais il ne faut pas froisser de sensibilit=E9s.] On Wed, 7 Apr 2004 16:02:54 -0400, jonathan dumaresq=20 <jdu...@ci...> wrote: > hi all. I just try to toggle the led on TINIm400 board. > > I know the pin on the borad is P5 bit 2 so I write this code: > > #include <tinibios.h> > #include <ds400rom.h> > > #include <stdio.h> > > void main (void) > { > long i; > printf ("\n\rHello from 390.\n\rSee you, bye jonathan...\n"); > while(1) > { > > P5 &=3D (~0x04); > for(i =3D 0 ; i < 1000; i++); // some delay > P5 |=3D 4 ; //led off > for(i =3D 0 ; i < 1000; i++); // some delay > } > > } > > here the batch file that i use to compile this code: > > set SDCCDIR=3DD:\Projet\TINI\sdcc-2.3.0-i586-mingw32msvc\sdcc > set SDCCINC=3D%SDCCDIR%\include > set SDCCLIB=3D%SDCCDIR%\lib\ds400 > set PATH=3D%SDCCDIR%\bin;%PATH% > > > sdcc -V -c -I %SDCCINC% -mds400 hello390.c > sdcc -V -L %SDCCLIB% -mds400 --model-flat24 --code-loc 0x400000 -Wl-r > hello390.rel > packihx hello390.ihx >hello390.hex > > if exist hello390.hex goto ok > > goto done > > :ok > > echo . BUILD COMPLTE > :done > > I compile it with no error. > > I use the ToolKit for tini set to 400 board and load the hex in bank 40= . > I type E > > and nothhing happen. > > I remove the code in the while(1) and I see: > > Hello from 390. > > See you, bye jonathan... > > > so I wonder what was the problem. If anyone here could take a look in m= y > little piece of code .. > > regards > > Jonathan Dumaresq > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > --=20 NEVER jump into a LOOP! |