Download Getting Started with dsPIC30F Digital Signal Controllers User's Guide
Transcript
Getting Started with dsPIC30F Digital Signal Controllers Appendix B. Code for dsPICDEM Starter Demonstration Board B.1 FLASH LED WITH dsPIC30F6012.s This appendix contains the sample code for the dsPICDEM Starter Demonstration Board. This tutorial example was written for the MPLAB ASM30 Assembler and the C30 C Compiler. ;=============================================================================; ; ; ; Software License Agreement ; ; ; ; The software supplied herewith by Microchip Technology Incorporated ; ; (the "Company") for its dsPIC controller is intended and supplied to ; ; you, the Company's customer, for use solely and exclusively on ; ; Microchip dsPIC products. The software is owned by the Company and/or ; ; its supplier, and is protected under applicable copyright laws. All ; ; rights are reserved. Any use in violation of the foregoing ; ; restrictions may subject the user to criminal sanctions under ; ; applicable laws, as well as to civil liability for the breach of the ; ; terms and conditions of this license. ; ; ; ; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES, ; ; WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ; ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ; ; PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY ; ; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL ; ; DAMAGES, FOR ANY REASON WHATSOEVER. ; ; ; ;=============================================================================; ; ; Use Timer 1 to flash LED RD4 when switch S1 is not pressed ; and flash LED RD5 when switch S1 is pressed ; ;============================================================================== .equ __30F6012, 1 .include "p30f6012.inc" ;-----------------------------------------------------------------------------;Global Declarations .global .global .global .global .global __reset __OscillatorFail __AddressError __StackError __MathError ;The label for the first line of code ;Declare Oscillator Fail trap routine label ;Declare Address Error trap routine label ;Declare Stack Error trap routine label ;Declare Math Error trap routine label ;-----------------------------------------------------------------------------;Configuration bits config config config config __FOSC, CSW_FSCM_OFF & XT_PLL4 __FWDT, WDT_OFF __FBORPOR, PBOR_OFF & BORV_27 & PWRT_16 & MCLR_EN __FGS, CODE_PROT_OFF © 2005 Microchip Technology Inc. DS70151A-page 105