Created Mon, 06 Aug 2012 11:19:09 +0000 by pablo
Mon, 06 Aug 2012 11:19:09 +0000
Hi guys!
I have the following problem. My max32 is working properly as a webserver, and I wanted to add an interrupt routine. Both of them work fine separately but when I merge them, the web cannot be loaded. Does anyone know why this happens? Aren't they compatible?
Thanks, Pablo
Tue, 07 Aug 2012 09:28:59 +0000
Who knows?
Without knowing what hardware you are using for the ethernet interface (and what interrupts it uses), and what interrupt you are trying to use it is impossible to tell.
Tue, 07 Aug 2012 10:01:52 +0000
You are right, my fault! Im using mpide 0023-windows-20120429-test with chipkit network shield. I've read that Multithreading is not supported, but there are ways to imitate it. And also that another way to deal with this could be with async tcp web server Arduino. It is more important the main code and the interrupt than the webserver, just in case this helps.
When I press a submit button on the web, configuration[j] changes from false to true.
I'm trying to merge this interrupt:
#include <plib.h>
const int numMaxFeeders = 64; boolean Configuration[numMaxFeeders] = { false}; boolean ResetCounter[numMaxFeeders] = { false}; int j; int counter[numMaxFeeders];
void setup() { OpenTimer1(T1_ON | T1_PS_1_256 | T1_SOURCE_INT, 6249); //OpenTimer1(T1_ON | T1_PS_1_256 | T1_SOURCE_INT, 4999); ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_1); INTEnableSystemMultiVectoredInt(); WriteTimer1(0);
pinMode(13, OUTPUT); digitalWrite(13, LOW); j=3; Configuration[3]=true;
}
void loop()
{
}
extern "C"
{
void __ISR(_TIMER_1_VECTOR,ipl1) pwmOn(void)
{
if(Configuration[j] == true && ResetCounter[j]==false){
counter[j]=0;
ResetCounter[j]=true;
digitalWrite(13, HIGH);
}
else if(Configuration[j] == true && ResetCounter[j]==true){
if((counter[j])>=3000){
digitalWrite(13, LOW);
Configuration[j] = false;
ResetCounter[j] = false;
}
}
counter[j]++;
mT1ClearIntFlag(); // Clear interrupt flag
}
}