element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Cypress Kits
  • Products
  • Dev Tools
  • Cypress Kits
  • More
  • Cancel
Cypress Kits
Forum PSoC 4 Pioneer Kit Community Project#07 – Danger Shield with 7 Segment LED Display
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Cypress Kits to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 6 replies
  • Subscribers 26 subscribers
  • Views 833 views
  • Users 0 members are here
  • pioneer
  • danger
  • 100projects
  • pwm
  • led
  • xor
  • breathing
  • shield
  • psoc_creator
  • kit
  • arduino
  • cypress
  • 4
  • psoc
Related

PSoC 4 Pioneer Kit Community Project#07 – Danger Shield with 7 Segment LED Display

cy.wbz
cy.wbz over 12 years ago

Hello!

 

Today’s example project uses the “Danger Shield” which includes a list of hardware features such as three large sliding potentiometers, LEDs, LDR light sensor, push buttons, buzzer, and a small 7 segment LED display. The example and descriptions are included in this post.

 

This example project uses the 7 segment LED display along with one of the Linear Potentiometers. The user will slide the potentiometer and the PSoC 4 will read the voltage value, scale that value and then display the value on the 7 segment display.

 

Forum Post Attachments:

 

At the bottom of this post we are including the following items:

  • Example Project Zip File
  • Zip File of Project Images
    • Project Schematic
    • Component Configurations

 

Components Used:

 

The user can download the example project at the bottom of this post. The project uses the following list of Creator Components:

  • ADC SAR
  • CyPin

 

The components are configured by right clicking on the component in your Top Design schematic view and selecting Configure. Please enable the following selections in the Configuration windows for the listed components above.

 

Firmware Description:

 

The main.c firmware is included in the example project. Please review the commented sections for more details.

This example project makes use of the large A0 Linear Potentiometer. The user can slide this potentiometer back and forth (adding an evil scientist cackle not necessary, but encouraged). The PSoC 4 will then use the ADC SAR component to read the voltage output from the A0 potentiometer and then scale that value and output the scaled value to the 7 segment LED display included on the Danger Shield board.

 

Hardware Connections:

 

There are no hardware connections outside of connecting the Danger Shield to the Pioneer Kit.

 

Test Your Project:

 

Once programmed with this project, you can slide the A0 potentiometer to see the output on the 7 segment LED display.

 

I hope this example can help you out in your design.

 

Best,

Matt

Attachments:
Project Images.zip
KIT_042_Danger_7SegmentDisplay.cyprj.Archive02.zip
  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 12 years ago +1
    Hey guys, I wrote this example, so I'm excited to hear your feedback. I'll check in regularly and answer questions if any arise. Before you tell me, yeah I know bit-banging is a pretty silly way to drive…
Parents
  • Former Member
    Former Member over 12 years ago

    Hey guys,

     

    I wrote this example, so I'm excited to hear your feedback. I'll check in regularly and answer questions if any arise.

     

    Before you tell me, yeah I know bit-banging is a pretty silly way to drive the shift register. We can also do it very easily with the SPI component, but that example will have to wait for another day. image

     

    -Max Kingsbury

    Applications Engineer

    Cypress Semiconductor

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • greatunclebulgaria
    greatunclebulgaria over 12 years ago in reply to Former Member

    Hay Max,

     

    Couple of questions if I may.

     

    1) Why do you effectively invert the ADC value? ie a low voltage will give you a high reading.

    2) Why do you bit bang 8 bits, and not just the one you are interested in? (I haven't looked at any documentation so I may be talking rubish) does not togeling 8 (potentially) bits consume more power than just 1?

     

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • greatunclebulgaria
    greatunclebulgaria over 12 years ago in reply to Former Member

    Hay Max,

     

    Couple of questions if I may.

     

    1) Why do you effectively invert the ADC value? ie a low voltage will give you a high reading.

    2) Why do you bit bang 8 bits, and not just the one you are interested in? (I haven't looked at any documentation so I may be talking rubish) does not togeling 8 (potentially) bits consume more power than just 1?

     

    Thanks

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 12 years ago in reply to greatunclebulgaria

    David,

     

    Thanks for the questions!

     

    1. The sliders on the danger shield are hooked up "backwards". The potentiometer voltage is high when the sliders are "low" (towards the user) and low when the sliders are "high" (away from the user). This requires an inversion somewhere in the system to achieve the desired functionality.

     

    2. We are shifting in 8 bits to drive the 8 segments of the LED display. We have to shift in all 8 bits to re-fill the serial-in, parralel-out. I'm not sure what the behavior is when you try to shift in less bits than the SIPO has, but you can't specify which bit you are shifting in, as the place is inferred from the position within the byte.

     

    Regards,

    Max

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • greatunclebulgaria
    greatunclebulgaria over 12 years ago in reply to Former Member

    Max,

     

    Thanks for your answers. I think we're talking at crossed purposes on the second one though.

     

    Pin_595N_Serial_In_D4_Write(0xff);

     

    This line writes one bit (high) of the 8 serial bits to the serial to parallel shift register, but the parameter passed is 8 bits (0xff), why is it not 0x01?

     

    3) Why are there offsets on the max and min readings, why those particular values, and why are they different?

     

    I'm very much enjoying this series of examples, an extremely good idea.

     

    Thanks

     

    David

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to greatunclebulgaria

    David,

     

    I understand your question now. The Pin Write API does in fact only set 1 bit. Writing 0x01 and 0xff will have the same effect. I use 0xff because it is more readable to me, but it's a matter of preference.

     

    I chose the max and min ADC limits after observing the voltages generated by the linear slider. I did not employ the potentiometer datasheet or any theoretical derivation of these values, I simply looked at them while debugging and set them that way.

     

    Glad you're enjoying the examples! We will keep them coming!

     

    -Max

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    I would liked to see pictures of the board you setup  for this project.  It sounds like you have many components involved.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube