4 Digit 7-segment LED driver for the PSoC6

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

cross mob
lock attach
Attachments are accessible only for community members.
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

There was a post just recently by a user wanting to driver 3 digits of a 7-segment LED on a PSoC6 device.

There is a component to driver multiple segments (7,14 and 16) and multiple digits on the PSoC3 and PSoC5.

Sadly, this component was not available for the PSoC6.

Here is a project to drive 4 digits of a 7-segment LED display for the PSoC6.  It implements most of the API calls for the PSoC3/PSoC5 component and is configured as 7-segment drive only.

This implementation differs from the Cypress component version in that:

  • It is not a component.  This requires copying the LED_7seg directory to the user's project directory.  Then LED_7seg directory needs to be added in the "Build/Compiler/Additional Include Directories" for the project.
  • It is intended as a 4 digit 7-segment LED display driver.  Elements in the TopDesign can easily be removed to support less digits or added to supportmore digits.
  • It is a 7-segment implementation only.  14-segment and 16-segment implementation code has been removed from LED_7seg.c
  • This implementation does NOT use DMA resources.
  • The refresh rate is fixed at 250 Hz.  However, this is easily changed by adjusting the CMN_clk component value.
  • The Segment drive is active HIGH and the common drive is active HIGH (going to the NPN transistors which invert the commons to an active LOW drive).
  • Brightness control is NOT implemented.
  • Most of the API calls of the Cypress component are implemented for 7-segments.

The following API calls are not implemented and will yield a compile error if called.

  • void LED_7seg_Write14SegNumberDec(int32 number, uint8 position, uint8 digits, uint8 alignment);
  • void LED_7seg_Write14SegNumberHex(uint32 number, uint8 position, uint8 digits, uint8 alignment);
  • void LED_7seg_WriteString14Seg(char8 const character[], uint8 position);
  • void LED_7seg_PutChar14Seg(char8 character , uint8 position);
  • void LED_7seg_Write14SegDigitDec(uint8 digit, uint8 position);
  • void LED_7seg_Write14SegDigitHex(uint8 digit, uint8 position);
  • void LED_7seg_Write16SegNumberDec(int32 number, uint8 position, uint8 digits, uint8 alignment);
  • void LED_7seg_Write16SegNumberHex(uint32 number, uint8 position, uint8 digits, uint8 alignment);
  • void LED_7seg_WriteString16Seg(char8 const character[], uint8 position);
  • void LED_7seg_PutChar16Seg(char8 character , uint8 position);
  • void LED_7seg_Write16SegDigitDec(uint8 digit, uint8 position);
  • void LED_7seg_Write16SegDigitHex(uint8 digit, uint8 position);
  • uint16 LED_7seg_EncodeNumber14Seg(uint8 number);
  • uint16 LED_7seg_EncodeChar14Seg(char8 input);
  • uint16 LED_7seg_EncodeNumber16Seg(uint8 number);
  • uint16 LED_7seg_EncodeChar16Seg(char8 input);
  • void LED_7seg_SetBrightness(uint8 bright, uint8 position);
  • uint8 LED_7seg_GetBrightness(uint8 position);

The file LED_7seg_Unit_Tests.c is supplied ONLY as test vectors to unit test this implementation.   This file can be removed from the project.

To use the API calls supported refer to the component datasheet for the 4 Digit 7-segment LED display driver.

This implementation can be constructed as a component for PSoC Creator if the demand is sufficient.  ModusToolbox doesn't directly* support UDBs or components at this time.  With some effort,  a ModusToolbox equivalent can be constructed.

With Cypress' permission, I can be convinced to modify their component to include a PSoC6-specific implementation that should be able to support 14- and 16-segments.

* ModusToolbox does not directly support UDBs for those PSoCs that have them.  There is a utility (UDBport) available from an advance PSoC user (RoNo_264271 ) that can port a Creator UDB design to the ModusToolbox.  You can find further information about this tool at this link:  Re: How do I create a custom UDB solution in the Modus toolbox?

Project Requirements:

  • This project is originally built with the PsoC6 used in the CY8CKIT-062-BLE.   Other PSoC6s and kits that support UDBs can be used.
  • PSoC Creator 4.3.  It should be able to run on earlier version but it has not been tested.
  • The TopDesign includes NPN transistors to drive the commons to the digits.  This is HIGHLY recommended due to the combined current if all segments are turned on.
  • The segments are being directly driven by the PSoC.  I recommend that the maximum drive current be limited to 8mA.  If more current is needed, I recommend that the segments be buffered using PNP transistors.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
1 Reply
SumitS_06
Moderator
Moderator
Moderator
10 likes given 5 likes given 100 sign-ins

Thank you for sharing this project with us.

0 Likes