Pumpkin, Inc.

Pumpkin User Forums

Signaling from ISR and Task

For issues specific to ARM7 and ARM9 targets, including compilers (e.g. Keil's RealView MDK) and IDEs (e.g. IAR's C-SPY).

Signaling from ISR and Task

Postby Gerald » Tue May 20, 2008 12:34 am

hi,

when i have the following example...
ISR and Task1 is signaling a message with different content!
if Task1 is signaling a message and task2 waits for receiving...the ISR might overwrite the num? Is there a solution from Salvo for this special case?

bye

static unsigned int num = 0;

ISR(SIG_OUTPUT_COMPARE1A)
{
//....

/* get message pointer (may be 0). */
while((msgP = OSTryMsg(MSG1_P)) != NULL)
{
OS_Delay(1);
}
num = 1;
OSSignalMsg(MSG1_P, (OStypeMsgP) &num);
}

void Task1()
{
while(1)
{
//....

/* get message pointer (may be 0). */
while((msgP = OSTryMsg(MSG1_P)) != NULL)
{
OS_Delay(1);
}
num = 2;
OSSignalMsg(MSG1_P, (OStypeMsgP) &num);
}
}

void Task2()
{
while(1)
{
//....

/* wait forever for a message. */
OS_WaitMsg(MSGQ1_P, &msgP);

receivednum = (unsigned int) msgP;
printf("received %d
", receivednum);
}
}

Gerald
 
Posts: 24
Joined: Tue Mar 11, 2008 11:00 pm

Return to ARM (ARM7 & ARM9)

Who is online

Users browsing this forum: No registered users and 1 guest

cron