--- In lpc2000@yahoogroups.com, "Joel Winarske" <joelw@...> wrote:
>
> > I am not able to understand why
> >
> > T0MR0 += L_COMPAREMATCH;
> >
> > doesn't work!!! I use other micro, such as Texas MSP430, and this
> > implementation work well! Is there a bug in micro or I have to do
> > something before read/write T0MR0???
>
> Hmm, I'm doing this on a LPC2148 with no problem:
>
> T0MR0 += SAMPLE_INTERVAL;
>
> Did you check the assembler output?
>
>
> Joel
>
Source code is:
void vPortPreemptiveTick( void )
{
#if portPRESCALE_VALUE != 0
#define L_COMPAREMATCH (configCPU_CLOCK_HZ /
configTICK_RATE_HZ) / portPRESCALE_VALUE
#else
#define L_COMPAREMATCH (configCPU_CLOCK_HZ /
configTICK_RATE_HZ)
#endif
if (T0IR & BIT(0))
{
T0MR0 += L_COMPAREMATCH;
/* Increment the tick counter. */
vTaskIncrementTick();
/* The new tick value might unblock a task. Ensure
the highest task that
is ready to execute is the task that will execute
when the tick ISR
exits. */
vTaskSwitchContext();
/* Ready for the next interrupt. */
T0IR = portTIMER_MATCH_ISR_BIT;
}
extern void vTmr0Cr0_Isr(void);
if (T0IR & BIT(4))
{
vTmr0Cr0_Isr();
T0IR = BIT(4);
}
VICVectAddr = portCLEAR_VIC_INTERRUPT;
}
L_COMPAREMATCH is equal to 0x1770. Checking assembler code, it seems
correct.
Assembler generated code is:
vPortPreemptiveTick:
PUSH {LR}
CFI ?RET Frame(CFA, -4)
CFI CFA R13+4
LDR R0,??vPortPreemptiveTick_0 ;; 0xe0004000
LDR R0,[R0, #+0]
LSL R0,R0,#+0x1F
BPL ??vPortPreemptiveTick_1
LDR R0,??DataTable4 ;; 0xe0004018
LDR R1,??DataTable4 ;; 0xe0004018
LDR R1,[R1, #+0]
LDR R2,??DataTable3 ;; 0x1770
ADD R1,R1,R2
STR R1,[R0, #+0]
_BLF vTaskIncrementTick,vTaskIncrementTick??rT
_BLF vTaskSwitchContext,vTaskSwitchContext??rT
LDR R0,??vPortPreemptiveTick_0 ;; 0xe0004000
MOV R1,#+0x1
STR R1,[R0, #+0]
??vPortPreemptiveTick_1:
LDR R0,??vPortPreemptiveTick_0 ;; 0xe0004000
LDR R0,[R0, #+0]
LSL R0,R0,#+0x1B
BPL ??vPortPreemptiveTick_2
_BLF vTmr0Cr0_Isr,vTmr0Cr0_Isr??rT
LDR R0,??vPortPreemptiveTick_0 ;; 0xe0004000
MOV R1,#+0x10
STR R1,[R0, #+0]
??vPortPreemptiveTick_2:
LDR R0,??vPortPreemptiveTick_0+0x4 ;; 0xfffff030
MOV R1,#+0
STR R1,[R0, #+0]
POP {R0}
BX R0 ;; return
DATA
??vPortPreemptiveTick_0:
DC32 0xe0004000
DC32 0xfffff030
CFI EndBlock cfiBlock7
Have you checked if interval tick is regular and corrected? Can you
give me Timer0 settings??? Thank you in advance!
EnricoMessage
Re: Multiple compare and capture on same Timer
2006-02-23 by gvnn77
Attachments
- No local attachments were found for this message.