Hey guys !
I am new here, first post ! I am a meng, so code and electronics are not really my strengths, but I know a few things from research and several projects. I am using a Netduino Plus for this project. It has some PID control and DAQ.
I am currently stuck with a 1200 dots per rev shaft encoder. Its a quadrature encoder, giving a phase A and B. I managed to build a decoding circuit (flip-flops,AND & NOR gates) and now I have 2 wires that give pulses for each direction of rotation. I do NOT have a dedicated counter so I am using the pulses to interrupt on GPIO of the netduino (is that wrong? ). Interrupt ports work fine ( position ++; ) however, I need the netduino to be constantly monitoring the process set value through the ADC. That means a while(true) loop and here is where the interrupts from the encoder stop working because the processor is stuck in the loop. If I break the loop, interrupts work fine, but it is no longer monitoring the set value.
I also run into ALOT of out of memory exceptions ( without even adding the print to console to start graphing), specially when the motor starts going fast ( crashes asa duty cycle goes above 45).
Options I tried to consider with no luck:
1) send the the required set values through USB instead of an Analog signal
2) send the values over TCP :
Would love to, as it adds wireless control feature, easily interface with matlab DAQ and simulink. However, I need alot of help coding that (code examples appreciated). Also I was advised that this will consume memory very fast.
I think my major problem is that I am used to matlabs xpc, so memory and sampling times were almost never an issue, plus multi tasking and threading / multi core support was also available so monitoring multiple variables and updating multiple varriables at the same time was not an issue either.
Please help, any advice is much appreciated and welcomed !!
Thanks in advance !!