Go Down

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

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.

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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy