MX32 CORE TIMER

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
tormod
Posts: 57
Joined: 29 Nov 2004 16:31

MX32 CORE TIMER

#1 Post by tormod » 30 Nov 2017 10:41

Trying to engage the core timer in 32MX460 series and studied the proposed example, but this was written in C. The problem is not to convert this to Pascal but obviously the Pascal is missing the IPC0Bits. record and the compiler stops on that as undefined. Can that be defined in Pascal, and how should it look like, or since this is concerning interrupts what is the correct code to manipulate the registers directly?

// *****************************************************************************
//
// procedure __SkrSupervisionInitTimer(;
//
// This routine clculates correct value for core timer timeout value.
// This routine does not start the timer.
//
// Formula: Ticks := (1/Fosc shr 1)*Time in seconds
//
// *****************************************************************************

begin
with Supervision do begin
TimerState := CNOTIMING;
TimeoutValue := TimeoutValue*Clock;
DisableInterrupts;
IFS0CLR := 0; // clear interrupts
IPC0bits.CTIP := 7; // interrupt priority 1-7
IPC0bits.CTIS := 0; // sub priority 0-3

EnableInterrupts;
end;
end;

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: MX32 CORE TIMER

#2 Post by dusan.poluga » 01 Dec 2017 18:41

Hi,

Download our Timer Calculator application.
It can generate timer interrupt initialization code for you for our mikroC, mikroBasic and mikroPascal compilers.

Best Regards,
Dusan Poluga.

tormod
Posts: 57
Joined: 29 Nov 2004 16:31

Re: MX32 CORE TIMER

#3 Post by tormod » 01 Dec 2017 23:49

The Timer Calculator has NO FEATURE FOR CALCULATINNG CORE TIMER ; ONLY TIMER 1-5, so what is the idea with that suggestion ??

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: MX32 CORE TIMER

#4 Post by filip » 15 Dec 2017 14:31

Hi,

I apologize for the issue, my colleague obviously misunderstood the question so he proposed Timer Calculator as a solution.

The IPC0Bits. record is not implemented in the Pascal as it is in C, so please use the standard notation from the datasheet IPC0.Bit_number.

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for PIC32 General”