Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.55 KB | None | 0 0
  1. #include "p18F45K20.inc"
  2. ;*******************************************************************************
  3. ; *
  4. ; Microchip licenses this software to you solely for use with Microchip *
  5. ; products. The software is owned by Microchip and/or its licensors, and is *
  6. ; protected under applicable copyright laws. All rights reserved. *
  7. ; *
  8. ; This software and any accompanying information is for suggestion only. *
  9. ; It shall not be deemed to modify Microchip?s standard warranty for its *
  10. ; products. It is your responsibility to ensure that this software meets *
  11. ; your requirements. *
  12. ; *
  13. ; SOFTWARE IS PROVIDED "AS IS". MICROCHIP AND ITS LICENSORS EXPRESSLY *
  14. ; DISCLAIM ANY WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING *
  15. ; BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS *
  16. ; FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL *
  17. ; MICROCHIP OR ITS LICENSORS BE LIABLE FOR ANY INCIDENTAL, SPECIAL, *
  18. ; INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, HARM TO *
  19. ; YOUR EQUIPMENT, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR *
  20. ; SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY *
  21. ; DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER *
  22. ; SIMILAR COSTS. *
  23. ; *
  24. ; To the fullest extend allowed by law, Microchip and its licensors *
  25. ; liability shall not exceed the amount of fee, if any, that you have paid *
  26. ; directly to Microchip to use this software. *
  27. ; *
  28. ; MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF *
  29. ; THESE TERMS. *
  30. ; *
  31. ;*******************************************************************************
  32. ; *
  33. ; Filename: *
  34. ; Date: *
  35. ; File Version: *
  36. ; Author: *
  37. ; Company: *
  38. ; Description: *
  39. ; *
  40. ;*******************************************************************************
  41. ; *
  42. ; Notes: In the MPLAB X Help, refer to the MPASM Assembler documentation *
  43. ; for information on assembly instructions. *
  44. ; *
  45. ;*******************************************************************************
  46. ; *
  47. ; Known Issues: This template is designed for relocatable code. As such, *
  48. ; build errors such as "Directive only allowed when generating an object *
  49. ; file" will result when the 'Build in Absolute Mode' checkbox is selected *
  50. ; in the project properties. Designing code in absolute mode is *
  51. ; antiquated - use relocatable mode. *
  52. ; *
  53. ;*******************************************************************************
  54. ; *
  55. ; Revision History: *
  56. ; *
  57. ;*******************************************************************************
  58.  
  59.  
  60.  
  61. ;*******************************************************************************
  62. ; Processor Inclusion
  63. ;
  64. ; TODO Step #1 Open the task list under Window > Tasks. Include your
  65. ; device .inc file - e.g. #include <device_name>.inc. Available
  66. ; include files are in C:\Program Files\Microchip\MPLABX\mpasmx
  67. ; assuming the default installation path for MPLAB X. You may manually find
  68. ; the appropriate include file for your device here and include it, or
  69. ; simply copy the include generated by the configuration bits
  70. ; generator (see Step #2).
  71. ;
  72. ;*******************************************************************************
  73.  
  74. ; TODO INSERT INCLUDE CODE HERE
  75.  
  76. ;*******************************************************************************
  77. ;
  78. ; TODO Step #2 - Configuration Word Setup
  79. ;
  80. ; The 'CONFIG' directive is used to embed the configuration word within the
  81. ; .asm file. MPLAB X requires users to embed their configuration words
  82. ; into source code. See the device datasheet for additional information
  83. ; on configuration word settings. Device configuration bits descriptions
  84. ; are in C:\Program Files\Microchip\MPLABX\mpasmx\P<device_name>.inc
  85. ; (may change depending on your MPLAB X installation directory).
  86. ;
  87. ; MPLAB X has a feature which generates configuration bits source code. Go to
  88. ; Window > PIC Memory Views > Configuration Bits. Configure each field as
  89. ; needed and select 'Generate Source Code to Output'. The resulting code which
  90. ; appears in the 'Output Window' > 'Config Bits Source' tab may be copied
  91. ; below.
  92. ;
  93. ;*******************************************************************************
  94.  
  95. ; TODO INSERT CONFIG HERE
  96.  
  97. ;*******************************************************************************
  98. ;
  99. ; TODO Step #3 - Variable Definitions
  100. ;
  101. ; Refer to datasheet for available data memory (RAM) organization assuming
  102. ; relocatible code organization (which is an option in project
  103. ; properties > mpasm (Global Options)). Absolute mode generally should
  104. ; be used sparingly.
  105. ;
  106. ; Example of using GPR Uninitialized Data
  107. ;
  108. ; GPR_VAR UDATA
  109. ; MYVAR1 RES 1 ; User variable linker places
  110. ; MYVAR2 RES 1 ; User variable linker places
  111. ; MYVAR3 RES 1 ; User variable linker places
  112. ;
  113. ; ; Example of using Access Uninitialized Data Section (when available)
  114. ; ; The variables for the context saving in the device datasheet may need
  115. ; ; memory reserved here.
  116. ; INT_VAR UDATA_ACS
  117. ; W_TEMP RES 1 ; w register for context saving (ACCESS)
  118. ; STATUS_TEMP RES 1 ; status used for context saving
  119. ; BSR_TEMP RES 1 ; bank select used for ISR context saving
  120. ;
  121. ;*******************************************************************************
  122.  
  123. ; TODO PLACE VARIABLE DEFINITIONS GO HERE
  124. INT_VAR UDATA_ACS
  125. taille_tableau RES 1
  126.  
  127.  
  128. ;*******************************************************************************
  129. ; Reset Vector
  130. ;*******************************************************************************
  131.  
  132. RES_VECT CODE 0x0000 ; processor reset vector
  133. GOTO START ; go to beginning of program
  134.  
  135. ;*******************************************************************************
  136. ; TODO Step #4 - Interrupt Service Routines
  137. ;
  138. ; There are a few different ways to structure interrupt routines in the 8
  139. ; bit device families. On PIC18's the high priority and low priority
  140. ; interrupts are located at 0x0008 and 0x0018, respectively. On PIC16's and
  141. ; lower the interrupt is at 0x0004. Between device families there is subtle
  142. ; variation in the both the hardware supporting the ISR (for restoring
  143. ; interrupt context) as well as the software used to restore the context
  144. ; (without corrupting the STATUS bits).
  145. ;
  146. ; General formats are shown below in relocatible format.
  147. ;
  148. ;------------------------------PIC16's and below--------------------------------
  149. ;
  150. ; ISR CODE 0x0004 ; interrupt vector location
  151. ;
  152. ; <Search the device datasheet for 'context' and copy interrupt
  153. ; context saving code here. Older devices need context saving code,
  154. ; but newer devices like the 16F#### don't need context saving code.>
  155. ;
  156. ; RETFIE
  157. ;
  158. ;----------------------------------PIC18's--------------------------------------
  159. ;
  160. ; ISRHV CODE 0x0008
  161. ; GOTO HIGH_ISR
  162. ; ISRLV CODE 0x0018
  163. ; GOTO LOW_ISR
  164. ;
  165. ; ISRH CODE ; let linker place high ISR routine
  166. ; HIGH_ISR
  167. ; <Insert High Priority ISR Here - no SW context saving>
  168. ; RETFIE FAST
  169. ;
  170. ; ISRL CODE ; let linker place low ISR routine
  171. ; LOW_ISR
  172. ; <Search the device datasheet for 'context' and copy interrupt
  173. ; context saving code here>
  174. ; RETFIE
  175. ;
  176. ;*******************************************************************************
  177.  
  178. ; TODO INSERT ISR HERE
  179. ecrire_tableau
  180. CLRF FSR0L,0
  181. MOVLW 0x01
  182. MOVWF FSR0H,0
  183.  
  184. sloop
  185. CLRF INDF0,0
  186. INCF FSR0L,1
  187. BTFSS FSR0L,4,0
  188. GOTO sloop
  189.  
  190. MOVLW 0x2D
  191. MOVWF INDF0
  192. INCF FSR0,1
  193.  
  194. MOVLW 0x04
  195. MOVWF INDF0
  196. INCF FSR0,1
  197.  
  198. MOVLW 0x02
  199. MOVWF INDF0
  200. INCF FSR0,1
  201.  
  202. MOVLW 0x0F
  203. MOVWF INDF0
  204. INCF FSR0,1
  205.  
  206. MOVLW 0x10
  207. MOVWF INDF0
  208. INCF FSR0,1
  209.  
  210. MOVLW 0x65
  211. MOVWF INDF0
  212. INCF FSR0,1
  213.  
  214. MOVLW 0x21
  215. MOVWF INDF0
  216. INCF FSR0,1
  217.  
  218. MOVLW 0x02
  219. MOVWF INDF0
  220. INCF FSR0,1
  221.  
  222. MOVLW 0x08
  223. ;MOVWF taille_tableau,1
  224.  
  225. RETURN ;taille_tableau
  226. ;*******************************************************************************
  227. ; MAIN PROGRAM
  228. ;*******************************************************************************
  229.  
  230. MAIN_PROG CODE ; let linker place main program
  231.  
  232. START2
  233.  
  234. ; TODO Step #5 - Insert Your Program Here
  235.  
  236.  
  237.  
  238. ;CALL ecrire_tableau
  239.  
  240.  
  241.  
  242. GOTO START2 ; loop forever
  243.  
  244. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement