Posted an update to my GSoC applciation.
.joe
Posted an update to my GSoC applciation.
.joe
So 11 hours in the lab, with mostly little to no progress finally culminated in a fully functional system.
Our system is basically a series a small microcontrollers with various devices attached to them, these devices communicated with our central PC by way of RS232 communication. In order to call specpfic funcitons on the PIC we basically just pass it a function address through the serial link, and the PIC jams it into a function pointer, and calls the function. It’s pretty neat, but…
What is strange is when we were setting this up, we ran into issues with the function pointers. Now UNB has decided that there is no purpose to me learning C, but here is what we did, and what we had to do to solve the problem.
Our first attempt.
int getFunctionAAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionA;
return result;
}
int getFunctionBAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionB;
return result;
}
This for some reason unknown to me doesn’t compile on the PIC… C you’ve done it to me again.
This how ever solves the problem…
int getFunctionAAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionA;
return result;
}
int getFunctionBAsPointerAddress(){
void (*resultPtr1)(int); // function ptr
result1 = &functionB;
return result1;
}
So this flies in the face of everything I know about programming, function variables should disappear once you have returned them… At least the names should anyway.
If anyone knows why this works the way it does and feels like letting me know… please do.
I’ve decided I might take a C course next year, even just as a bird course so I can learn this stuff properly.
Good saturday to you all.
.joe
So, day one is over, I’ve established a bit of a cool look and feel around here so I think I’ve been pretty productive.
Also, I posted my first draft for my GSoC proposal, just waiting for the CF people to look over it before I submit it. It does look to be a pretty interesting topic. If you are interested please feel free to have a look and check it out.
In the coming days while I have time I am going to try and start posting stuff about my previous projects. Seems like it will more likely happen when I get done with this term though.
Anyway, I’m out, thanks for stopin by.
.joe
So in an effort to do everything like my buddy Josh…… I’ve started up my little space on the internet. The idea being that I can publish information about projects I’ve been working on. And projects I have worked on as well. Where applicable I’ll post code, and maybe someone somewhere will find some of this stuff useful. If not it will at least give me a way to track what I’ve done with my life…
So anyway stay tuned… It promises to be, well probably fairly mundane, a bit geeky, and likely typo filled.
.joe