Pages: [1]   Go Down
Author Topic: PIC look-up table  (Read 2113 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8602
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26525
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why does the title include the abbreviation "PIC"?


(PIC lookups usually use the RETLW instruction)
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26525
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So why not ask on a PIC forum?

sp. "want to".
« Last Edit: February 23, 2011, 08:33:46 am by AWOL » Logged

"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.

Pages: [1]   Go Up
Jump to: