Thread: Disable interrupt in ARM M0 program

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    7

    Disable interrupt in ARM M0 program

    How do i disable the interrupt in this ARM M0 univesity design start program?
    The design is made for the M0 and echos an inputted char as an integer, it is part of a larger piece of code (which is ommitted for simplicity)
    Can i do it in the main program(attached) or will i have to edit the assembler code(also attached)?






    //--------------------------------------------------------------
    Code:
    ----------------
        // Cortex-M0 DesignStart C program example
        //------------------------------------------------------------------------------
        
        #include <stdio.h>
        #include <time.h>
        #include <rt_misc.h>
        #include <stdlib.h>
        
        #define AHB_LED_BASE                0x50000000
        #define AHB_UART_BASE                0x51000000
        
        
        void UART_ISR(void)
        {
                    int sample;
                    char ch [16];
                    sample = atoi (ch);
                    printf("the value entered is %d\n", sample);
        }
        
        //////////////////////////////////////////////////////////////////
        // Main Function
        //////////////////////////////////////////////////////////////////
        
        int main() 
            {
            
                char ch [16];
                while(1==1)
                {
                fgets (ch, 16, stdin);
            //printf("String: %s\n\n",ch);
                }
        }
    Assembly code


    Code:
    UART_Handler    PROC
                        EXPORT UART_Handler
                        IMPORT UART_ISR
                        PUSH    {R0,R1,R2,LR}
                        LDR     R1, =0x51000000               ;UART
                        LDR     R0, [R1]                      ;Get Data from UART
                        STR     R0, [R1]                      ;Write to UART
        
                        BL UART_ISR
        
                        POP     {R0,R1,R2,PC}
                        ENDP
        
                        
                        ALIGN 4

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Check the compiler documentation - this should tell you how to disable interrupts using C. Reviewing the data sheet for the specific device would also be a good idea, as there might be more than a single interrupt configuration (i.e. global enable/disable versus individual).

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    There is some one asking like the totally same question here

    arm - Disable Interrupt in C program - Stack Overflow

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program for External Interrupt for PIC 16F877A
    By a_arrun in forum C Programming
    Replies: 3
    Last Post: 12-02-2013, 05:36 PM
  2. How could I disable ctrl+alt+del in my program
    By obaid in forum C# Programming
    Replies: 9
    Last Post: 07-19-2008, 11:40 AM
  3. ASM interrupt and others
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 06-08-2002, 07:18 PM
  4. interrupt
    By juandy in forum C++ Programming
    Replies: 4
    Last Post: 05-21-2002, 08:24 AM
  5. Interrupt???
    By GiSH in forum C++ Programming
    Replies: 1
    Last Post: 11-15-2001, 12:27 PM

Tags for this Thread