This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
These are very, very basic questions about the C language. This probably isn't the best forum to talk about it. This forum is here to discuss the particulars of the Tiva hardware and it's tools (like the C compiler). So it's going to be hard to explain everything.
Are you talking a class? The class should have some reference or prerequisite material on programming in general and the C language. There are plenty of books and a google search of "C Language tutorial" should find some online information to get you started.
main is the function all C programs use. It basically defines the start of the program.
STATUS = -1;
sets STATUS variable to -1.
MStatus == -1
"Is the MStatus variable equal to negative 1?"
The == operator is a test for equality, while = is an assignment.
// Tcount is the number of clock cycles to delay
int32_t TotalDelay(int32_t Tcount)
{
int32_t STATUS = 0;
// Check to see if the number of clock cycles
// is more than what SysTickDelay can accept.
// consult the datasheet section 3.3 to see that it
// is limited to 24 bits
while (Tcount > MAXcount)
{
// Change the return status
STATUS = -1;
// Delay the maximum amount
SysTickDelay(MAXcount);
// Reduce the amount of clock cycles to wait
// by how long we just delayed in SysTickDelay()
Tcount = Tcount - MAXcount;
// Now go back to the while() loop and check to see
// if we need to loop again
}
SysTickDelay(Tcount);
// This return status value does not make sense to me. Why
// would the caller care if we had to loop?
return (STATUS); // Return 0, or -1 if we had to loop
}
Is this something you wrote? Is it working for you?