Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Adding an LED to an FN0 Pin - KBA80842

lock attach
Attachments are accessible only for community members.

Adding an LED to an FN0 Pin - KBA80842

Anonymous
Not applicable

Version: *A

Question:

How do I add a generic LED to an FN0 pin in the PowerPSoC® device?

Answer:

Currently, the FN0_x pins do not appear in the Port selection drop-down menu of the LED User Module in PSoC Designer. The following steps can be used as a workaround to connect an LED to an FN0_x pin without placing the LED User Module.

  1. Copy the .asm, .inc, and .h files of the appropriate FN0 pin into the project directory that contains the main.c file.
      For example, for pin FN0[0], copy LED_FN0_0.inc, LED_FN0_0.asm, and LED_FN0_0.h.
  2. Copy the LED_FN0_General.asm file into the project directory that contains the main.c file.
  3. In PSoC Designer, select Project > Add File. Use the Files of Type drop-down to select All Files (*.*). Select the three LED_FN0 files copied in steps 1 and 2, and then click Open.
  4. Open each file that calls the LED_FN0 function. Include the C header file (.h) with the command:
      #include filename
      For example:
      #include LED_FN0_0.h
  5. Call the Start function, LED_FN0_0_Start(), as shown in the attached example project in the main.c file..
      It sets the correct drive mode of the pins.
  6. Call any of the other LED functions as needed.
  7. Option: The LED drive is set to active high (LED_On sets the output to HIGH). To change to active low, open the LED_FN0_x.inc file, and change the value of LED_FN0_x_Drive to 0 (LED_FN0_0_Drive:     equ   0).

The sample project attached connects the FN0_0 pin to an LED. In this project, the state of the LED is toggled periodically.

Attachments
0 Likes
351 Views
Contributors