element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum Have a question about Micrium's embedded software? Ask our Expert, Matt Gordon
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 35 replies
  • Subscribers 495 subscribers
  • Views 4305 views
  • Users 0 members are here
  • applications
  • device
  • embedded
  • kernel
  • micrium
Related

Have a question about Micrium's embedded software? Ask our Expert, Matt Gordon

Former Member
Former Member over 14 years ago

This thread has been closed to new questions.

However, we welcome you to Post Your Question about Embedded in the element14 Community Embedded group. You'll find many fellow members and experts who have just the answer you're looking to find! 

 

Thank You, Your Friends at element14 Community

image

 

Matt Gordon

Matt Gordon is a senior applications engineer at Micrium.  He began his career developing device drivers, kernel ports, and example applications for Micrium's customers.  Drawing on this experience, Matt has written multiple articles on embedded software.  He also heads Micrium's training program and regularly teaches classes on real-time kernels and other embedded software components.  Matt holds a bachelor's degree in computer engineering from Georgia Tech, Georgia in the USA.


  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 14 years ago

    Hi Matt, I am a newbie to RTOS and i have started with uCOS III.

     

     

              OSSemCreate(&MySem,                                                                                 // Creating Semaphore

                           "SerialPortSemaphore",

                                                                1,

                                                                &err);

     

    I want to make my semaphore to enable the UART, but i dont know how. I have made another function that enables the UART and this function is called from the switch statement just after the OSSemPend(...).

    Please help me with this, or just show me an example to create and use a semaphore.

     

    Best Regards.

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

    Typically, the purpose of a semaphore used with a UART is to signal the reception of data.  The semaphore post takes place in the UART's receive ISR, and the pend occurs in the code responsible for processing the data.  This setup is illustrated in the below example.  (I've omitted the semaphore creation code from this example, since it would simply involve the function call named above.)

     

    void  UART_ISR (void)

    {

        /* Clear interrupt flag */

        OSSemPost (&AppSemUART, OS_OPT_POST_1, &err);

    }

     

    void  UART_Task (void *p_arg)

    {

        while (1) {

            OSSemPend(&AppSemUART, OS_CFG_TICK_RATE_HZ, OS_OPT_PEND_BLOCKING, 0, &err);

            /* Read from buffer and process data */

        }

    }

     

    Regards,

     

    Matt

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

    Typically, the purpose of a semaphore used with a UART is to signal the reception of data.  The semaphore post takes place in the UART's receive ISR, and the pend occurs in the code responsible for processing the data.  This setup is illustrated in the below example.  (I've omitted the semaphore creation code from this example, since it would simply involve the function call named above.)

     

    void  UART_ISR (void)

    {

        /* Clear interrupt flag */

        OSSemPost (&AppSemUART, OS_OPT_POST_1, &err);

    }

     

    void  UART_Task (void *p_arg)

    {

        while (1) {

            OSSemPend(&AppSemUART, OS_CFG_TICK_RATE_HZ, OS_OPT_PEND_BLOCKING, 0, &err);

            /* Read from buffer and process data */

        }

    }

     

    Regards,

     

    Matt

    • 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 © 2026 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