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 LED controlled  Project
  • 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 3 replies
  • Subscribers 27 subscribers
  • Views 572 views
  • Users 0 members are here
  • psoc_4200
  • psoc
Related

LED controlled  Project

vead11
vead11 over 10 years ago

Hello

I am new here, I hope someone will guide me I have psoc 4 device   I am doing experiment with LED. I have LED on psoc 4.  LED is connected port P1[7].  I am trying to set alarm for LED using RTC

image

 

(D/M/Y     H/M/S)

LED will turn on for 5 second on date 22/5/2015  time 5:50:10  

LED will turn on fo 10 minute on date 23/5/2015   time 5:50:10

LED will turn on for 5 hours on date 24 /5/2015      time 5:50:10

 

I am attaching project workspace. I am getting problem in program 

Attachments:
rtc_led.Bundle01.zip
  • Sign in to reply
  • Cancel
Parents
  • clem57
    clem57 over 10 years ago

    I do not see where the Pin gets setup to trigger the LED. Your code looks incomplete. Why are the interrups disablled? You need them if you expect to do something on the alarm from the RTC.

    Clem

    PS. I would try things in steps. First See if you can blink the LED without RTC.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • vead11
    vead11 over 10 years ago in reply to clem57

    Hello Clem

    I have done LED blinking project without RTC

    look at this attachment

     

    my code is incomplete. I need help to complete code

     

    #include <project.h>

    #include <stdio.h>

     

    /* Time: 02:59:50 */

    #define TIME_HOUR           (0x02u)

    #define TIME_MIN            (0x59u)

    #define TIME_SEC            (0x50u)

    #define HOUR_OFFSET         (16u)

    #define MIN_OFFSET          (8u)

    #define TIME_HR_MIN_SEC     ((uint32)(TIME_HOUR << HOUR_OFFSET) | \

                                (uint32)(TIME_MIN << MIN_OFFSET)    | \

                                 TIME_SEC)

    /* Date: 05/16/2015 */

    #define DATE_MONTH          (RTC_MARCH)

    #define DATE_DAY            (0x16u)

    #define DATE_YEAR           (0x2015u)

    #define MONTH_OFFSET        (24u)

    #define DAY_OFFSET          (16u)

    #define DATE_MONTH_DAY_YEAR ((uint32)(DATE_MONTH << MONTH_OFFSET)   | \

                                (uint32)(DATE_DAY << DAY_OFFSET)        | \

                                 DATE_YEAR)

     

    /* Alarm Time: 15:44:00 */

    #define ALARM_HOUR                  (0x04u)

    #define ALARM_MIN                   (0x01u)

    #define ALARM_SEC                   (0x30u)

    #define ALARM_TIME_HR_MIN_SEC       ((uint32)(ALARM_HOUR << HOUR_OFFSET) | \

                                        (uint32)(ALARM_MIN << MIN_OFFSET)    | \

                                         ALARM_SEC)

     

    /* Alarm Date: 12/18/2014 */

    #define ALARM_DATE_MONTH_DAY_YEAR   (DATE_MONTH_DAY_YEAR)

     

     

     

    /* Alarm structure declaration */

    RTC_DATE_TIME alarmTimeDate;

     

    /* Alarm flag initialization */

    uint32 alarmFlag = 0;

     

     

    /* Interrupt prototypes */

    CY_ISR_PROTO(WdtIsrHandler);

    CY_ISR_PROTO(AlarmIsrHandler);

     

     

    int main()

    {

       

        /* Alarm structure initialization */

        alarmTimeDate.time = ALARM_TIME_HR_MIN_SEC;

        alarmTimeDate.date = ALARM_DATE_MONTH_DAY_YEAR;

       

        /* Starts RTC component */

        RTC_Start();

       

        /* Set Date and Time */

        RTC_SetDateAndTime(TIME_HR_MIN_SEC,DATE_MONTH_DAY_YEAR);

     

       

          /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */

        for(;;)

        {

            /* Place your application code here. */

        }

    }

     

    /* [] END OF FILE */

    Attachments:
    Design03.Bundle01.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • vead11
    vead11 over 10 years ago in reply to clem57

    Hello Clem

    I have done LED blinking project without RTC

    look at this attachment

     

    my code is incomplete. I need help to complete code

     

    #include <project.h>

    #include <stdio.h>

     

    /* Time: 02:59:50 */

    #define TIME_HOUR           (0x02u)

    #define TIME_MIN            (0x59u)

    #define TIME_SEC            (0x50u)

    #define HOUR_OFFSET         (16u)

    #define MIN_OFFSET          (8u)

    #define TIME_HR_MIN_SEC     ((uint32)(TIME_HOUR << HOUR_OFFSET) | \

                                (uint32)(TIME_MIN << MIN_OFFSET)    | \

                                 TIME_SEC)

    /* Date: 05/16/2015 */

    #define DATE_MONTH          (RTC_MARCH)

    #define DATE_DAY            (0x16u)

    #define DATE_YEAR           (0x2015u)

    #define MONTH_OFFSET        (24u)

    #define DAY_OFFSET          (16u)

    #define DATE_MONTH_DAY_YEAR ((uint32)(DATE_MONTH << MONTH_OFFSET)   | \

                                (uint32)(DATE_DAY << DAY_OFFSET)        | \

                                 DATE_YEAR)

     

    /* Alarm Time: 15:44:00 */

    #define ALARM_HOUR                  (0x04u)

    #define ALARM_MIN                   (0x01u)

    #define ALARM_SEC                   (0x30u)

    #define ALARM_TIME_HR_MIN_SEC       ((uint32)(ALARM_HOUR << HOUR_OFFSET) | \

                                        (uint32)(ALARM_MIN << MIN_OFFSET)    | \

                                         ALARM_SEC)

     

    /* Alarm Date: 12/18/2014 */

    #define ALARM_DATE_MONTH_DAY_YEAR   (DATE_MONTH_DAY_YEAR)

     

     

     

    /* Alarm structure declaration */

    RTC_DATE_TIME alarmTimeDate;

     

    /* Alarm flag initialization */

    uint32 alarmFlag = 0;

     

     

    /* Interrupt prototypes */

    CY_ISR_PROTO(WdtIsrHandler);

    CY_ISR_PROTO(AlarmIsrHandler);

     

     

    int main()

    {

       

        /* Alarm structure initialization */

        alarmTimeDate.time = ALARM_TIME_HR_MIN_SEC;

        alarmTimeDate.date = ALARM_DATE_MONTH_DAY_YEAR;

       

        /* Starts RTC component */

        RTC_Start();

       

        /* Set Date and Time */

        RTC_SetDateAndTime(TIME_HR_MIN_SEC,DATE_MONTH_DAY_YEAR);

     

       

          /* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */

        for(;;)

        {

            /* Place your application code here. */

        }

    }

     

    /* [] END OF FILE */

    Attachments:
    Design03.Bundle01.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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