On Sat, 2013-06-08 at 17:15 +0800, JIA Pei wrote:

> #include <reg51.h>

Did you read the replies on your previous post ?
You did not respond to them (yet).
Hint : sdcc must be giving you a warning about
NOT using reg51.h


> void int0()  interrupt 1
> {  TH0=0xd8;   
>    TL0=0xef;   
>    n--;   
> }   

The proper setup of the interrupt routine with a current
sdcc version is like the following :

void Timer0_ISR(void) __interrupt tf0_vector
{
        ....;
}

tf0_vector can be replaced with a number if you like as it
already is a number set with #define in the processor type
header file.

   
> void delay (unsigned char m)
> {   
>  unsigned i=3*m;

This variable is unsigned type what ?
I am assuming integer due to the three times multiplication
of a char (max value 255 * 3).


> void delayms(unsigned char a)
> {   
>   while(--a);
> }   

If you want strict timing, like a millisecond delay, use
a hardware timer.

   
> play:   
>    while(1)   
>     {   
>     a: p=music_tab[i];   
>        if(p==0x00)       { i=0, delayms(1000); goto play;}

A "goto", seriously ?

Still no mention of the sdcc version.......
And no specific errors noted that sdcc gave.

roelof

ps: advise : please clean up your code writing skills. It
looks like s**t.



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

Reply via email to