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

Using the Dallas Semiconductor 450

Getting Error C141: syntax error near 'void' HELP

HERE IS THE CODE---

#include <reg51.h>
void MSDelay (unsigned int);
sbit input=P0^0;
sbit input2=P0^1;
sbit LLight=P1^1;
sbit RLight=P1^2;
sbit Bell=P1^3;
void main(void)
{ unsigned int i; input=0xFF; //'input' Input Port// input2=0xFF; //'input2' Input Port// LLight=0x00; //'LLight' As Output Port// RLight=0x00; //'RLight' As Output Port// Bell=0x00; //'Bell' As Output Port//
{ LLight=00; RLight=00; Bell=00; while (1) { { Bell=1; LLight=1; RLight=0; MSDelay (2500); } { Bell=1; LLight=0; RLight=1; MSDelay (2500); } }
} void MSDelay (unsigned int itime) { unsigned int i, j; for (i=0;i<itime;i++) for (j=0;j<1275;j++); }

Parents
  • #include <reg51.h>
    
    void MSDelay (unsigned int);
    
    sbit input = P0^0;
    sbit input2 = P0^1;
    sbit LLight = P1^1;
    sbit RLight = P1^2;
    sbit Bell = P1^3;
    
    void main(void)
    {
            unsigned int i;
            input = 0xFF; //'input' Input Port//
            input2 = 0xFF; //'input2' Input Port//
            LLight = 0x00; //'LLight' As Output Port//
            RLight = 0x00; //'RLight' As Output Port//
            Bell = 0x00; //'Bell' As Output Port//
            {
                    LLight = 00;
                    RLight = 00;
                    Bell = 00;
                    while (1)
                    {
                            {
                                    Bell = 1;
                                    LLight = 1;
                                    RLight = 0;
                                    MSDelay (2500);
                            }
                            {
                                    Bell = 1;
                                    LLight = 0;
                                    RLight = 1;
                                    MSDelay (2500);
                            }
                    }
            }
    
    void MSDelay (unsigned int itime)
    {
            unsigned int i, j;
            for (i = 0; i < itime; i++)
                    for(j = 0; j < 1275; j++);
    }
    

Reply
  • #include <reg51.h>
    
    void MSDelay (unsigned int);
    
    sbit input = P0^0;
    sbit input2 = P0^1;
    sbit LLight = P1^1;
    sbit RLight = P1^2;
    sbit Bell = P1^3;
    
    void main(void)
    {
            unsigned int i;
            input = 0xFF; //'input' Input Port//
            input2 = 0xFF; //'input2' Input Port//
            LLight = 0x00; //'LLight' As Output Port//
            RLight = 0x00; //'RLight' As Output Port//
            Bell = 0x00; //'Bell' As Output Port//
            {
                    LLight = 00;
                    RLight = 00;
                    Bell = 00;
                    while (1)
                    {
                            {
                                    Bell = 1;
                                    LLight = 1;
                                    RLight = 0;
                                    MSDelay (2500);
                            }
                            {
                                    Bell = 1;
                                    LLight = 0;
                                    RLight = 1;
                                    MSDelay (2500);
                            }
                    }
            }
    
    void MSDelay (unsigned int itime)
    {
            unsigned int i, j;
            for (i = 0; i < itime; i++)
                    for(j = 0; j < 1275; j++);
    }
    

Children
No data