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

Help on C51 programming

Hi, i am currently working on the project on 8051. The software that i am using is keil uVision3.

i am writing a delay loop for my LED but there is a syntax error in the code. Below is the code:

(1) void delay_time(void)
(2) {
(3)     unsigned int a,b;
(4)     for(a=0, a<100, a++)
(5)             for(b=0, b<100, b++);
(6) }

and the syntax error is:

line(4): error C141: syntax error near ')'
line(5): error C141: syntax error near ')'


Can anyone help me on this?
Any help is greatly appreciated!

Parents
  • In the case of a very simple, first program where all that matters is the LED being on for a while and off for a while - a 'for' loop delay in 'C' is (probably) adequate providing it doesn't get removed by the optimiser, as others have already noted.

    However for any other use you should definitely use assembler for a software delay

    See: www.8052.com/.../read.phtml for the reason why, and how to do it.

Reply
  • In the case of a very simple, first program where all that matters is the LED being on for a while and off for a while - a 'for' loop delay in 'C' is (probably) adequate providing it doesn't get removed by the optimiser, as others have already noted.

    However for any other use you should definitely use assembler for a software delay

    See: www.8052.com/.../read.phtml for the reason why, and how to do it.

Children
No data