Controlling LEDS in Pcan Router Pro

4-Channel CAN Router with Data Logger
Post Reply
chemmy
Posts: 3
Joined: Sun 14. Aug 2016, 09:49

Controlling LEDS in Pcan Router Pro

Post by chemmy » Mon 15. Aug 2016, 17:27

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

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Controlling LEDS in Pcan Router Pro

Post by PEAK-Support » Mon 15. Aug 2016, 18:12

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...
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

chemmy
Posts: 3
Joined: Sun 14. Aug 2016, 09:49

Re: Controlling LEDS in Pcan Router Pro

Post by chemmy » Mon 15. Aug 2016, 21:11

Sorry. I thought it was obvious.

I use the C compiler, writing my own code.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Controlling LEDS in Pcan Router Pro

Post by PEAK-Support » Mon 15. Aug 2016, 21:27

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
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

chemmy
Posts: 3
Joined: Sun 14. Aug 2016, 09:49

Re: Controlling LEDS in Pcan Router Pro

Post by chemmy » Mon 15. Aug 2016, 21:52

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?

User avatar
S.Schott
Hardware Development
Hardware Development
Posts: 32
Joined: Mon 4. Oct 2010, 16:50

Re: Controlling LEDS in Pcan Router Pro

Post by S.Schott » Tue 16. Aug 2016, 08:28

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

Post Reply