Timers Microseconds
Posted: Tue Mar 10, 2020 10:54 am
Hello,
I want to use the Timers Modul in my Application with microseconds as unit.
While my Application works with milliseconds, it does not work with microseconds even though the build is
successful.
Can you tell me what i'm doing wrong?
Many thanks in advance for your help!
I always get the following message in the Terminal:
Error: input parameter has an unexpected value
Timers.Init @08003028H, Line: 123
Pins.Run @080043D0H, Line: 48
Pins..init @08004624H, Line: 88
r0 = 00000000H 0
r1 = 00007000H 28672
r2 = 00007700H 30464
r3 = 00000700H 1792
r4 = 0000F000H 61440
r5 = 40020020H 1073872928
r6 = 40020000H 1073872896
r7 = 0000000CH 12
r8 = 000F4240H 1000000
r9 = 00000003H 3
r10 = 08002E54H 134229588
r11 = 00000003H 3
r12 = 20013C08H 536951816
This is how i initalized the timer:
MODULE Pins;
IMPORT GPIO, Main, MCU, SYSTEM, Timers, Out, Serial, Math;
CONST
PORTA = MCU.GPIOABase;
VAR
inputPin: GPIO.Pin;
outputPin: GPIO.Pin;
PROCEDURE* ConfigureIntput(VAR config: GPIO.PortConfiguration);
BEGIN
config.mode := GPIO.Mode_In;
config.speed := GPIO.Speed_High;
config.outputType := GPIO.Push_Pull;
config.resistors := GPIO.Pull_Down;
config.alternateFunction := GPIO.AF0
END ConfigureIntput;
PROCEDURE* ConfigureOutput(VAR config: GPIO.PortConfiguration);
BEGIN
config.mode := GPIO.Mode_Out;
config.speed := GPIO.Speed_High;
config.outputType := GPIO.Push_Pull;
config.resistors := GPIO.Floating;
config.alternateFunction := GPIO.AF0
END ConfigureOutput;
PROCEDURE Run();
VAR
x: SET;
measureTimer: Timers.Timer;
configIn: GPIO.PortConfiguration;
configOut: GPIO.PortConfiguration;
state: BOOLEAN;
duration: INTEGER;
distance: INTEGER;
BEGIN
(* enable clock for GPIO-A *)
SYSTEM.GET(MCU.RCC_AHBENR, x);
SYSTEM.PUT(MCU.RCC_AHBENR, x + {MCU.RCC_AHBENR_GPIOA});
(* Initialize timer*)
Timers.Init(measureTimer, Timers.TIM3, Timers.uSecs);
I want to use the Timers Modul in my Application with microseconds as unit.
While my Application works with milliseconds, it does not work with microseconds even though the build is
successful.
Can you tell me what i'm doing wrong?
Many thanks in advance for your help!
I always get the following message in the Terminal:
Error: input parameter has an unexpected value
Timers.Init @08003028H, Line: 123
Pins.Run @080043D0H, Line: 48
Pins..init @08004624H, Line: 88
r0 = 00000000H 0
r1 = 00007000H 28672
r2 = 00007700H 30464
r3 = 00000700H 1792
r4 = 0000F000H 61440
r5 = 40020020H 1073872928
r6 = 40020000H 1073872896
r7 = 0000000CH 12
r8 = 000F4240H 1000000
r9 = 00000003H 3
r10 = 08002E54H 134229588
r11 = 00000003H 3
r12 = 20013C08H 536951816
This is how i initalized the timer:
MODULE Pins;
IMPORT GPIO, Main, MCU, SYSTEM, Timers, Out, Serial, Math;
CONST
PORTA = MCU.GPIOABase;
VAR
inputPin: GPIO.Pin;
outputPin: GPIO.Pin;
PROCEDURE* ConfigureIntput(VAR config: GPIO.PortConfiguration);
BEGIN
config.mode := GPIO.Mode_In;
config.speed := GPIO.Speed_High;
config.outputType := GPIO.Push_Pull;
config.resistors := GPIO.Pull_Down;
config.alternateFunction := GPIO.AF0
END ConfigureIntput;
PROCEDURE* ConfigureOutput(VAR config: GPIO.PortConfiguration);
BEGIN
config.mode := GPIO.Mode_Out;
config.speed := GPIO.Speed_High;
config.outputType := GPIO.Push_Pull;
config.resistors := GPIO.Floating;
config.alternateFunction := GPIO.AF0
END ConfigureOutput;
PROCEDURE Run();
VAR
x: SET;
measureTimer: Timers.Timer;
configIn: GPIO.PortConfiguration;
configOut: GPIO.PortConfiguration;
state: BOOLEAN;
duration: INTEGER;
distance: INTEGER;
BEGIN
(* enable clock for GPIO-A *)
SYSTEM.GET(MCU.RCC_AHBENR, x);
SYSTEM.PUT(MCU.RCC_AHBENR, x + {MCU.RCC_AHBENR_GPIOA});
(* Initialize timer*)
Timers.Init(measureTimer, Timers.TIM3, Timers.uSecs);