Go Down

Topic: PIC look-up table (Read 2200 times) previous topic - next topic

fuzzbenji

Hii,

i'm trying to make a look-up table for my programs. I wanna make a small application with a few buttons so I can chose my different program with their related button.
Now, i don't really know how i can start to make my look-up table, and how i put my programs into it.


Thanks!!

Graynomad

Both my boards are refusing to upload at the moment so I can't test, but this should be close

Code: [Select]
void func_1 (void) {
  Serial.println ("func_1");
}

void func_2 (void) {
  Serial.println ("func_2");
}

void func_3 (void) {
  Serial.println ("func_3");
}

void (*funcs [])(void) = {
func_1,
func_2,
func_3
};

void setup () {
Serial.begin (115200);
}

void loop () {
 int i;
 
   i = 0;

 funcs[i++]();
  funcs[i++]();
  funcs[i]();
 
}


______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

AWOL

Why does the title include the abbreviation "PIC"?


(PIC lookups usually use the RETLW instruction)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

fuzzbenji

because i wanna use the look up table in my pic code...

AWOL

#4
Feb 23, 2011, 02:29 pm Last Edit: Feb 23, 2011, 02:33 pm by AWOL Reason: 1
So why not ask on a PIC forum?

sp. "want to".
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up