Hello everyone,
I am a starter on xmc programming, which is why I watched the getting started video. There they used the Apps eventdetector, eventgenerator and interrupt for handling a signal coming from a button.
I was trying to do the same on my board, buut it didn't work.
Setup:
XMC1100
LED1 at p.2.0
BUTTON1 at p 2.1
==> both are working, tested it with an if function in the main code.
Because the button only has ON or OFF i set its mode to input and "pull down" ==> previosly it was sensing an input every 4th run-through because there were slighly different inputs every time (as Tristate)
LED is set al Output, Mode = Push-Pull and the initial outputlevel is low
APPS
DITIAL_IO x2 (as explained)
EVENT_DETECTOR
source=b
edge-detection = falling
EVENT_GENERATOR
pattern detection is not enabled
INTERRUPT
Inizialised at start
preemption priority =3
Interrupthandler = externaleventhandler
HW-Connections
BUTTON pin goes to signal b of EVENT_DETECTOR
EVENT_DETECTOR trigger_out goes to trigger_in of EVENT_GENERATOR
EVENT_GENERATOR iout goes to sr_Irq of INTERRUPT
Main Code:
If i try it on my board, the LED doesn't turn on. Why? where is the problem?
Thanks for help!
BTW, I linked the project to the post. Its name is XMC1100_LED_PWM because I planned to work with the PWM on this project first.
Attachment 1935
I am a starter on xmc programming, which is why I watched the getting started video. There they used the Apps eventdetector, eventgenerator and interrupt for handling a signal coming from a button.
I was trying to do the same on my board, buut it didn't work.
Setup:
XMC1100
LED1 at p.2.0
BUTTON1 at p 2.1
==> both are working, tested it with an if function in the main code.
Because the button only has ON or OFF i set its mode to input and "pull down" ==> previosly it was sensing an input every 4th run-through because there were slighly different inputs every time (as Tristate)
LED is set al Output, Mode = Push-Pull and the initial outputlevel is low
APPS
DITIAL_IO x2 (as explained)
EVENT_DETECTOR
source=b
edge-detection = falling
EVENT_GENERATOR
pattern detection is not enabled
INTERRUPT
Inizialised at start
preemption priority =3
Interrupthandler = externaleventhandler
HW-Connections
BUTTON pin goes to signal b of EVENT_DETECTOR
EVENT_DETECTOR trigger_out goes to trigger_in of EVENT_GENERATOR
EVENT_GENERATOR iout goes to sr_Irq of INTERRUPT
Main Code:
Code:
/*
* main.c
*
* Created on: 2015 Dec 28 15:08:15
* Author: Timo
*/
#include <DAVE.h> //Declarations from DAVE Code Generation (includes SFR declaration)
/**
* @brief main() - Application entry point
*
* <b>Details of function</b><br>
* This routine is the application entry point. It is invoked by the device startup code. It is responsible for
* invoking the APP initialization dispatcher routine - DAVE_Init() and hosting the place-holder for user application
* code.
*/
int main(void)
{
DAVE_STATUS_t status;
status = DAVE_Init(); /* Initialization of DAVE APPs */
if(status == DAVE_STATUS_FAILURE)
{
/* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}
/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
}
void externaleventhandler(void)
{
DIGITAL_IO_SetOutputHigh(&LED1);
}
}
Thanks for help!
BTW, I linked the project to the post. Its name is XMC1100_LED_PWM because I planned to work with the PWM on this project first.
Attachment 1935