??? 01/22/07 21:03 Read: times |
#131223 - Concepts Responding to: ???'s previous message |
Roque Obusan said:
This helps me a lot. Just a few things I'm ashamed to admit that I don't understand what some of these lines do. As we didn't cover them in C class... No need to be ashamed that you didn't initially understand them - but there's no need to limit it yourself to just what's been taught in class. You do have a 'C' textbook, don't you? This is standard 'C' - so you should be able to look it up in your textbook. 1. "#define A_0 (A_I0 | A_I1)" - everytime i type in A_0 it gets or'd with A_I0 and A_I1? No - review the operation of the preprocessor: Everywhere you type "A_0" it gets replaced with "(A_I0 | A_I1)" 2. "static code char sequence[] = { A_MINUS | A_0 | B_PLUS | B_67, A_PLUS | A_33 | B_PLUS | B_67, A_PLUS | A_67 | B_PLUS | B_67, A_PLUS | A_67 | B_PLUS | B_33, A_PLUS | A_67 | B_PLUS | B_0, A_PLUS | A_67 | B_MINUS | B_33, A_PLUS | A_67 | B_MINUS | B_67, A_PLUS | A_33 | B_MINUS | B_67, A_PLUS | A_0 | B_MINUS | B_67, A_MINUS | A_33 | B_MINUS | B_67, A_MINUS | A_67 | B_MINUS | B_67, A_MINUS | A_67 | B_MINUS | B_33, A_MINUS | A_67 | B_MINUS | B_0, A_MINUS | A_67 | B_PLUS | B_33, A_MINUS | A_67 | B_PLUS | B_67, A_MINUS | A_33 | B_PLUS | B_67 };"What is a static code char sequence[]? 'sequence' is a variable name; 'static' and 'char' are standard 'C' keywords - look them up in the textbook; 'code' is a non-standard, compiler-specific extension to the language - you would need to look this up in the appropriate compiler manual Russ was a little naugthy in posting code that relies upon compiler-specific extensions - without stating what compiler is required! Tut! Tut! Almost certainly, the 'code' directs the compiler to place this "object" into the 8051's CODE space (since it is a constant). My guess is that it's an array with 16 values. It is. What does the word static do for the array? See textbook. the tutorial i read about macro's (sic) gave me this form "#define MULT(x, y) x * y" where whatever i typed in for x and y would be multiplied. I hope the tutorial didn't actually say that. The macro knows nothing about multiplication; it is all just text substitution - it's only the compiler that looks at the result, and interprets it as a multiplication |
Topic | Author | Date |
8051 & L6219 (Stepper Motor Driver) | 01/01/70 00:00 | |
CNCZone | 01/01/70 00:00 | |
Maybe this will help | 01/01/70 00:00 | |
this helps a lot | 01/01/70 00:00 | |
Think Search and Replace | 01/01/70 00:00 | |
static | 01/01/70 00:00 | |
static about 'static' and 'code' | 01/01/70 00:00 | |
That's modularity for you! | 01/01/70 00:00 | |
Different Reason | 01/01/70 00:00 | |
Concepts | 01/01/70 00:00 | |
Imprecise comment | 01/01/70 00:00 | |
Another imprecise comment | 01/01/70 00:00 | |
Ah... That is the catch :) | 01/01/70 00:00 | |
Better | 01/01/70 00:00 | |
Yup | 01/01/70 00:00 | |
Works Beautifully | 01/01/70 00:00 | |
Another happy ending | 01/01/70 00:00 | |
One more problem - Direction | 01/01/70 00:00 | |
Extra Table Shouldn't Be Necessary | 01/01/70 00:00 | |
thats what i thought too | 01/01/70 00:00 | |
nevermind i screwed up...![]() | 01/01/70 00:00 | |
Visit Jones on Stepping Motors | 01/01/70 00:00 |