⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap_1.tex

📁 renesas M16C62 单片机调试通过的中断源码
💻 TEX
字号:
锘縗section{Introduction}The purpose of this small project is to get familiar with hardware interrupts on the Mulle platform and also the concepts of using semaphores. LED blinking is implemented as a reaction to an external interrupt. \section{Code description}\begin{itemize}    \item C Files - \texttt{main.c, hwinit.c, inithandler.c}    \item Header Files - \texttt{hardware.h, inithandler.h, iodefine.h, sema.h}	\item Others - \texttt{makefile, main.ls, start.S, vects.S}\end{itemize}\texttt{main.c} is the main file for this small project. It calls function \texttt{hw\_initialise} from \texttt{hwinit.c}, which sets port P81 as Output port. Port P81 is input port by default and connected with the battery.  Setting it as output port will turn off the battery measurements circuit. Semaphores are unset initially. Interrupt1 is enabled on level 3. The program then sets global interrupts on by executing \texttt{fset} command of assembly language. On every interrupt the interrupt handler sets the semaphore. The program checks the status of semaphore, if it is set then it unsets the semaphore and led status is checked by using a variable. If it is found on, it is set off and vice versa.   To ease the compiling and linking, a \texttt{Makefile} is created. It generates \texttt{filename.mot} file for the M16C/62 microcontroller. This .mot file is the file that can load and run on MULLE. The Makefile uses a linker script, \texttt{main.ls}, to link the C files with the assembly files (\texttt{vects.S, start.S}) to generate a M16C/62 microcontroller \texttt{.mot} file. \\\textbf {Note:} \small{A pre-compiled mot file \texttt{main.mot} is also included in the attached files. Anybody can download and run it on Mulle even if they dont have the compiler environment installed}\section{How to run this program}Open \texttt{m32c-elf Toolchain}\\Type - \texttt{make}It will produce three files, \texttt{main.map, main.mot}, and \texttt{main.out}. \texttt{.mot} file is Motorola Hex File for the M16C/62 microcontroller. Download \texttt{main.mot} to MULLE and run it.\section {Output on MULLE}A LED placed on the Mulle will be ON at bootup. On an interrupt it will go off, and on next interrupt it will be on again. It will keep toggling on every interrupt. 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -