![]() |
MPLAB syntax error?? No Way!!
1 Attachment(s)
OK, I am no programming Guru, so I am asking for help.
I am coding a simple torque limiting function. I have very carefully checked my work, yet when I "Build All", MPLAB says I made a Syntax error. When I comment out the entire function, the error goes away. Please take a look at it and comment to your hearts content. The error is on line 111, which is where my first "if" takes place. Code:
/******************************************************** **************************** |
Re: MPLAB syntax error?? No Way!!
what is MAXTORQUE defined to?
|
Re: MPLAB syntax error?? No Way!!
you are defining setpmw, but using setpwm after the if statements
|
Re: MPLAB syntax error?? No Way!!
Yep.
Is that a valid return statement? I thought it should be return(variable); |
Re: MPLAB syntax error?? No Way!!
Silly question, but MAXTORQUE is defined globally somewhere? Hmm... is that a syntax error or something else?
If you comment out the first if thru to the else /*if .... else*/ so the else if is now an if, does the error drop down to that if or does it go away? |
Re: MPLAB syntax error?? No Way!!
The setpwm / setpmw error will crop up after this error is fixed.
Heh. I feel like I'm on a game show, with all these answers coming back. |
Re: MPLAB syntax error?? No Way!!
Quote:
Quote:
|
Re: MPLAB syntax error?? No Way!!
Quote:
Did you put a semicolon or anything after #define MAXTORQUE 100 |
Re: MPLAB syntax error?? No Way!!
Does this c file #include the bob.h file? Or is this file bob.c? If you (temporarily) define MAXTORQUE in this file does the error go away?
|
Re: MPLAB syntax error?? No Way!!
Quote:
I tried the comment out as you suggested before posting the question. The error moves to the new "if" statement. |
Re: MPLAB syntax error?? No Way!!
Quote:
If you change MAXTORQUE to 100 does the error go away? (I'm also imagining poor billbo911 running from the computer with mplab all the way across the room to the computer with internet access.) |
Re: MPLAB syntax error?? No Way!!
Quote:
No, it doesn't go away when defined locally. Quote:
No semi-colon on definition. BUT!!! We have a winner!!! The line looked like this "#define MAXTORQUE = 100" The equal sign killed it. Quote:
THANK YOU EVERYONE for helping me find this problem.!! Note to self: "=" good in variable declaration, bad in definition. |
Re: MPLAB syntax error?? No Way!!
Quote:
|
| All times are GMT -5. The time now is 23:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi