FIQ interrupt of Sunplus 16-bit microcontroller

Publisher:MagicalSerenadeLatest update time:2016-05-11 Source: eefocusKeywords:Sunplus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Function implementation: Open and set TimerA and TimerB timers, and turn on their FIQ interrupts. When there is a FIQ interrupt request from TimerA/B, respond to the corresponding interrupt service routine, and flip the I/O port output level in the interrupt service to control the on and off of the light-emitting diode connected to the I/O port. 

Experimental phenomenon: TimerA timing length is 2s. When entering the FIQ interrupt of TimerA, the output level of the lower four bits of IOA port is flipped to control the light-emitting diode connected to the lower four bits of IOA port; TimerB timing length is 1s. When entering the FIQ interrupt of TimerB, the output level of the lower four bits of IOB port is flipped to control the light-emitting diode connected to the lower four bits of IOB port. When the program is running, it can be observed that the light-emitting diode connected to the lower four bits of IOA port has a light-on and light-off cycle of 4s, while that connected to the lower four bits of IOB port is 2s.

 

 

 


#include "SPCE061A.H"
unsigned int n,Output1=0x00f0,Output2=0x000f;
void FIQ(void)__attribute__((ISR));
void FIQ()
{
    if(*P_INT_Ctrl&0x2000)//When it is a TimerA interrupt, it is b13
    {
        *P_INT_Clear = 0x2000;
        Output1^=0xffff;
        *P_IOA_Data = Output1;    
    }
    if(*P_INT_Ctrl&0x0800)//When the TimerB interrupt is b11
    {
        *P_INT_Clear = 0x0800;    
        Output2^=0xffff;
        *P_IOA_Data = Output2;
    }
}
int main( )
{
    __asm("FIQ OFF");
    
    *P_IOA_Dir = 0x00ff;
    *P_IOA_Attrib = 0x00ff;
    *P_IOA_Data = 0x0000;
    
    
    *P_TimerA_Ctrl = 0x000d; //1024HZ selected
    *P_TimerA_Data = 0xffff-2048;
    
    *P_TimerB_Ctrl = 0x0004; //4096 selected
    *P_TimerB_Data = 0xffff-4096;
    
    *P_INT_Ctrl = 0x2800;
    __asm( "FIQ ON");
    while(1)
    {
        *P_Watchdog_Clear = 0x0001;
    }

Keywords:Sunplus Reference address:FIQ interrupt of Sunplus 16-bit microcontroller

Previous article:External interrupts of Sunplus 16-bit MCU
Next article:Sunplus 16-bit MCU timer interrupt

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号