Hi,..
the thing is, the hardware is horrendous.. I must admit I didn't build/design all of it myself.
I think the program looks ok on paper, but doesn't run.
In Java I'm used to compilers being fussy where you declare variables, in loops is a big no no for instance.. as it re assigns storage every time round the loop. Which makes for slow running programs. (Worse than that, it eats memory, as you keep all the old pointers till the garbage collector gets them)
I suppose I was just after someone to put an experienced eye over that bit of code, incase I'm doing anything that's a bit of a daft thing to do in C.
I *MUST* do a C course, the only one I started got a bit caught up in malloc etc etc.. things we don't really use in the mbed world afaik.
cheers,
Dave.
Hi all..
Here's an explanation, but you can probably jump straight to the code. (The code below is for a differential opAmp circuit. I can control a reference voltage, and by reading the output voltage deduce what the analogue input voltage is. I'm reading to 0.04v, and so I have a 10x multiplier on the opAmp, so I can accurately read the input. I'll explain if anyone is interested. But it works PERFECTLY)
This code runs perfectly in a while loop, on its own in a main. It is subsecond.
If I attach it to a ticker, and run it every 21 secs. Mbed hangs. I presume with a memory problem.
I'm new to C, being a Java programmer. This would all be fine in the languages I usually work in. What am I doing that's enough of a bad practise to cause mbed to hang ?