Demonstration Program Operation
3.4
DEMONSTRATION CODE OPERATION
The following sections describe in more detail how the demonstration programs
interact with and take advantage of key dsPIC DSC, DSP and peripheral features. Full
details on the peripheral functionality and associated tasks are presented later in this
document.
3.4.1
Interrupt Processing
The demonstration code samples switches S1 and S2 and uses their status to operate
the LEDs associated with processor ports RD4 and RD5, respectively. If S1 is pressed,
it sets program flag “ LED1on ”. If S1 is pressed again, it resets program flag LED1on.
Similarly, if S2 is pressed, it toggles program flag LED2on .
Another interrupt routine checks flags LED1on and LED2on every 500 milliseconds. If
the LED1on is true, the LED labeled RD4 is toggled on and off every 0.5 seconds,
causing the LED to blink. If LED1on is not true, the LED remains off.
This demo program is illustrated in Figure 3-1.
FIGURE 3-1:
INTERRUPT PROCESSING FLOW DIAGRAM
START
INIT TIMER 1
For 0.5 Sec Interval
S1 Pressed?
Yes
LED1on = LED1on
S1 Released?
No
No
Yes
S2 Pressed?
Yes
LED2on = LED2on
S2 Released?
No
No
Start of 0.5 sec
Timer1 Init
Yes
? 2006 Microchip Technology Inc.
LED1on Flag Set?
No
Turn RD4 Off
LED2on Flag Set?
No
Turn RD5 Off
Return
Yes
Yes
RD4 = RD4
RD5 = RD5
DS51584B-page 27
相关PDF资料
DM300024 KIT DEMO DSPICDEM 1.1
DM330012 KIT USB STARTER FOR DSPIC33E
DM330013 MICROSTICK DSPIC33F/PIC24H BOARD
DNET1 SURGE SUPPRESSOR ETHERNET RJ45
DR-8094 RACK DOUBLE 84"X20.25"X36" BLK
DR-IAC5E INPUT MODULE AC 5VDC
DRIDC24A INPUT MODULE DC 34MA 24VDC
DRODC24 OUTPUT MODULE DC 13MA 24VDC
相关代理商/技术参数
DM300019 制造商:Microchip Technology Inc 功能描述:DEMO BOARD STARTER ((NW))
DM300020 功能描述:开发板和工具包 - PIC / DSPIC dsPICDEM MC1 Motor C RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM300021 功能描述:开发板和工具包 - PIC / DSPIC High V Pwr Module RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM300021 制造商:Microchip Technology Inc 功能描述:MODULE dsPICDEM MC1H 3 PHASE
DM300022 功能描述:开发板和工具包 - PIC / DSPIC Low V Pwr Module RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM300023 功能描述:开发板和工具包 - PIC / DSPIC dsPICDEM SMPS Buck Demo Brd RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM300024 功能描述:开发板和工具包 - PIC / DSPIC dsPICDEM 1.1 GP RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM300027 功能描述:开发板和工具包 - PIC / DSPIC 16-bit Starter Demo Board RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: