bigdogguru
Administrator
- Joined
- Mar 12, 2010
- Messages
- 9,821
- Helped
- 2,350
- Reputation
- 4,694
- Reaction score
- 2,272
- Trophy points
- 1,413
- Location
- Southwest, USA
- Activity points
- 62,394
Yes, I can understand structures now...
Good. Structures are not difficult to use or understand.
... I think I know what you are up to using ISR. Using ISR I can keep running in the main function right?, and constantly check all the variables.
Yes, you are beginning to see the bigger picture.
So I must first connect std to interrupt pin right?
The RB0 is an external interrupt pin and you already have STD connected to it.
Any intterupt will call the dtmfToNumber function if std = 1.
Sort of, we will write a lite version dtmfToNumber(), the ISR can handle a number of interrupt events. And with a mechanized device such as your design, you might need them.
The important concept to remember with ISRs is keep is short and sweet, no heavy lifting, get in and get out. All you want to do is record an event occurred, store data, etc.
And if mode = 1 (manual mode), I can make a new nested "if" structure to call the moving functions.
if mode = 2 (navigational mode), another nested "if" structure to carry out its function. I'll also use some more sbits to keep track where's the user is in a nested loop.
Or the other way, put all this if loops in ISR and the ISR calls the nessassary function ?
Yes, but I have another trick up my sleeve to handle the Mode Routine Modules.
I'm introducing you to the real power of the C language, a side of C most people never learn or use.
I would like for you to study pointers in C. When you learn and understand pointers, you will have taken the first step in really mastering C. We'll being using them a lot in the future revisions of your program.
Some tutorials on pointers in C:
Pointers in C
Everything you need to know about pointers in C
Structures in C - Covers a little on structure pointers
Programs as Data: Function Pointers - a glimpse into the future
I'll work on the ISR later today.
BigDog