Page 1 of 1

Controlling LEDS in Pcan Router Pro

Posted: Mon 15. Aug 2016, 17:27
by chemmy
Hi

I am trying to control the leds (for debugging and monitoring purposes).
I succeed to turn on and off the green LEDs as descriced in the example that comes with it. I can not control the color of these LEds to Red or orange and I can not control the other LEDs (The RED blinking LEDs during programming).

Can you refer me to a more elaborated example and/or documentation in this regards?

Thanks

Re: Controlling LEDS in Pcan Router Pro

Posted: Mon 15. Aug 2016, 18:12
by PEAK-Support
Did you use the PPCAN-Editor and configure the module, or do you use the C-Compiler and build a own firmware - this importend information is missing...

Re: Controlling LEDS in Pcan Router Pro

Posted: Mon 15. Aug 2016, 21:11
by chemmy
Sorry. I thought it was obvious.

I use the C compiler, writing my own code.

Re: Controlling LEDS in Pcan Router Pro

Posted: Mon 15. Aug 2016, 21:27
by PEAK-Support
please take a look into the hardware.h file:

Code: Select all

//! Set a LED to a specific color.
//!
//! @param		hLED		handle of the LED, see LED-handles
//! @param		color		color to set, see HW_LED_RED ...
//!
//! @return		one error of HW_ERR_...
HWStatus_t		HW_SetLED (	LEDHandle_t  hLED, LEDColor_t  color);
you will also find the definitions for the LEDs

Code: Select all

////////////////////////////////////////////////////////////
//! @name LED-handles
//! Handles to the LEDs. Not all LEDs are available on all targets.
#define	HW_LED_STATUS		0		//!< status LED
#define	HW_LED_CAN1			1		//!< LED CAN1
#define	HW_LED_CAN2			2		//!< LED CAN2
#define	HW_LED_CAN3			3		//!< LED CAN3
#define	HW_LED_CAN4			4		//!< LED CAN4
#define	HW_LED_CAN1b		5		//!< second LED CAN1
#define	HW_LED_CAN2b		6		//!< second LED CAN2
#define	HW_LED_CAN3b		7		//!< second LED CAN3
#define	HW_LED_CAN4b		8		//!< second LED CAN4
and the color

Code: Select all

////////////////////////////////////////////////////////////
//! @name LED-colors
//! Colors used for the LEDs
#define	HW_LED_OFF			0		//!< LED switch OFF
#define	HW_LED_RED			1		//!< LED switch red
#define	HW_LED_GREEN		2		//!< LED switch green
#define	HW_LED_ORANGE		3		//!< LED switch orange

Re: Controlling LEDS in Pcan Router Pro

Posted: Mon 15. Aug 2016, 21:52
by chemmy
Thanks!

I saw all that and tried to change color of main LEDs (HW_LED_CANx) and succeeded only to set it to green or off.
for the secondary leds (HW_LED_CANxb) I couldn't set it at all. Continously off no matter what color I set.

HW_SetLED ( HW_LED_CAN4b, HW_LED_RED); should work?

Re: Controlling LEDS in Pcan Router Pro

Posted: Tue 16. Aug 2016, 08:28
by S.Schott
Hello there.

PCAN-Router Pro has -no- multicolor LEDs at CAN ports.
One is green and one is red.
You just may set them to either ON or OFF.
- - -

The file is written to fit all our hardware products,
like e.g. PCAN Router which indeed has 2 multicolor LEDs.
But not 4 as defined in the file.
Also you may find that the PCAN-Router has no beeper ...

Greetings
Stefan