Advertisement
tmax

Untitled

Sep 16th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Disassembly Listing for multiples pwm
  2. Generated From:
  3. /Users/andrestorti/Downloads/multiples pwm.X/dist/default/production/multiples_pwm.X.production.cof
  4. Sep 17, 2015 12:50:38 AM
  5.  
  6. ---  /Users/andrestorti/Downloads/multiples pwm.X/main.c  -----------------------------------------------
  7. 1:             /*
  8. 2:              * File:   main.c
  9. 3:              * Author: LEO
  10. 4:              *
  11. 5:              * Created on 16 de septiembre de 2015, 16:46
  12. 6:              */
  13. 7:            
  14. 8:             #include <xc.h>
  15. 9:            
  16. 10:            // CONFIG1H
  17. 11:            #pragma config FOSC = INTIO67   // Oscillator Selection bits (Internal oscillator block, port function on RA6 and RA7)
  18. 12:            #pragma config FCMEN = OFF      // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
  19. 13:            #pragma config IESO = OFF       // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
  20. 14:            
  21. 15:            // CONFIG2L
  22. 16:            #pragma config PWRT = OFF       // Power-up Timer Enable bit (PWRT disabled)
  23. 17:            #pragma config BOREN = SBORDIS  // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
  24. 18:            #pragma config BORV = 18        // Brown Out Reset Voltage bits (VBOR set to 1.8 V nominal)
  25. 19:            
  26. 20:            // CONFIG2H
  27. 21:            #pragma config WDTEN = OFF      // Watchdog Timer Enable bit (WDT is controlled by SWDTEN bit of the WDTCON register)
  28. 22:            #pragma config WDTPS = 32768    // Watchdog Timer Postscale Select bits (1:32768)
  29. 23:            
  30. 24:            // CONFIG3H
  31. 25:            #pragma config CCP2MX = PORTC   // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
  32. 26:            #pragma config PBADEN = OFF     // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
  33. 27:            #pragma config LPT1OSC = OFF    // Low-Power Timer1 Oscillator Enable bit (Timer1 configured for higher power operation)
  34. 28:            #pragma config HFOFST = OFF     // HFINTOSC Fast Start-up (The system clock is held off until the HFINTOSC is stable.)
  35. 29:            #pragma config MCLRE = OFF      // MCLR Pin Enable bit (RE3 input pin enabled; MCLR disabled)
  36. 30:            
  37. 31:            // CONFIG4L
  38. 32:            #pragma config STVREN = OFF     // Stack Full/Underflow Reset Enable bit (Stack full/underflow will not cause Reset)
  39. 33:            #pragma config LVP = ON         // Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
  40. 34:            #pragma config XINST = OFF      // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
  41. 35:            
  42. 36:            // CONFIG5L
  43. 37:            #pragma config CP0 = OFF        // Code Protection Block 0 (Block 0 (000800-001FFFh) not code-protected)
  44. 38:            #pragma config CP1 = OFF        // Code Protection Block 1 (Block 1 (002000-003FFFh) not code-protected)
  45. 39:            #pragma config CP2 = OFF        // Code Protection Block 2 (Block 2 (004000-005FFFh) not code-protected)
  46. 40:            #pragma config CP3 = OFF        // Code Protection Block 3 (Block 3 (006000-007FFFh) not code-protected)
  47. 41:            
  48. 42:            // CONFIG5H
  49. 43:            #pragma config CPB = OFF        // Boot Block Code Protection bit (Boot block (000000-0007FFh) not code-protected)
  50. 44:            #pragma config CPD = OFF        // Data EEPROM Code Protection bit (Data EEPROM not code-protected)
  51. 45:            
  52. 46:            // CONFIG6L
  53. 47:            #pragma config WRT0 = OFF       // Write Protection Block 0 (Block 0 (000800-001FFFh) not write-protected)
  54. 48:            #pragma config WRT1 = OFF       // Write Protection Block 1 (Block 1 (002000-003FFFh) not write-protected)
  55. 49:            #pragma config WRT2 = OFF       // Write Protection Block 2 (Block 2 (004000-005FFFh) not write-protected)
  56. 50:            #pragma config WRT3 = OFF       // Write Protection Block 3 (Block 3 (006000-007FFFh) not write-protected)
  57. 51:            
  58. 52:            // CONFIG6H
  59. 53:            #pragma config WRTC = OFF       // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) not write-protected)
  60. 54:            #pragma config WRTB = OFF       // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)
  61. 55:            #pragma config WRTD = OFF       // Data EEPROM Write Protection bit (Data EEPROM not write-protected)
  62. 56:            
  63. 57:            // CONFIG7L
  64. 58:            #pragma config EBTR0 = OFF      // Table Read Protection Block 0 (Block 0 (000800-001FFFh) not protected from table reads executed in other blocks)
  65. 59:            #pragma config EBTR1 = OFF      // Table Read Protection Block 1 (Block 1 (002000-003FFFh) not protected from table reads executed in other blocks)
  66. 60:            #pragma config EBTR2 = OFF      // Table Read Protection Block 2 (Block 2 (004000-005FFFh) not protected from table reads executed in other blocks)
  67. 61:            #pragma config EBTR3 = OFF      // Table Read Protection Block 3 (Block 3 (006000-007FFFh) not protected from table reads executed in other blocks)
  68. 62:            
  69. 63:            // CONFIG7H
  70. 64:            #pragma config EBTRB = OFF      // Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks)
  71. 65:            
  72. 66:            #define led1red         LATAbits.LATA4
  73. 67:            #define led1green       LATAbits.LATA5
  74. 68:            #define led1blue        LATEbits.LATE0
  75. 69:            
  76. 70:            #define led2red         LATEbits.LATE1
  77. 71:            #define led2green       LATEbits.LATE2
  78. 72:            #define led2blue        LATAbits.LATA7
  79. 73:            
  80. 74:            #define led3red         LATAbits.LATA6
  81. 75:            #define led3green       LATCbits.LATC0
  82. 76:            #define led3blue        LATCbits.LATC1
  83. 77:            
  84. 78:            #define led4red         LATCbits.LATC2
  85. 79:            #define led4green       LATCbits.LATC3
  86. 80:            #define led4blue        LATDbits.LATD0
  87. 81:            
  88. 82:            #define led5red         LATDbits.LATD1
  89. 83:            #define led5green       LATDbits.LATD2
  90. 84:            #define led5blue        LATDbits.LATD3
  91. 85:            
  92. 86:            #define led6red         LATCbits.LATC4
  93. 87:            #define led6green       LATCbits.LATC6
  94. 88:            #define led6blue        LATDbits.LATD4
  95. 89:            
  96. 90:            #define led7red         LATDbits.LATD5
  97. 91:            #define led7green       LATDbits.LATD6
  98. 92:            #define led7blue        LATDbits.LATD7
  99. 93:            
  100. 94:            #define led8red         LATBbits.LATB0
  101. 95:            #define led8green       LATBbits.LATB1
  102. 96:            #define led8blue        LATBbits.LATB2
  103. 97:            
  104. 98:            #define led9red         LATBbits.LATB3
  105. 99:            #define led9green       LATBbits.LATB4
  106. 100:           #define led9blue        LATBbits.LATB5
  107. 101:          
  108. 102:          
  109. 103:           //demas pines utilizados
  110. 104:           #define MCLR            PORTEbits.RE3
  111. 105:           #define PGC             LATBbits.LATB6
  112. 106:           #define PGD             LATBbits.LATB7
  113. 107:           #define ANALOG0         PORTAbits.RA0
  114. 108:           #define ANALOG1         PORTAbits.RA1
  115. 109:           #define ANALOG2         PORTAbits.RA2
  116. 110:           #define ANALOG3         PORTAbits.RA3
  117. 111:          
  118. 112:          
  119. 113:          
  120. 114:          
  121. 115:          
  122. 116:           #define     duty1red    dutys[0]
  123. 117:           #define     duty1green  dutys[1]
  124. 118:           #define     duty1blue   dutys[2]
  125. 119:           #define     duty2red    dutys[3]
  126. 120:           #define     duty2green  dutys[4]
  127. 121:           #define     duty2blue   dutys[5]
  128. 122:           #define     duty3red    dutys[6]
  129. 123:           #define     duty3green  dutys[7]
  130. 124:           #define     duty3blue   dutys[8]
  131. 125:           #define     duty4red    dutys[9]
  132. 126:           #define     duty4green  dutys[10]
  133. 127:           #define     duty4blue   dutys[11]
  134. 128:           #define     duty5red    dutys[12]
  135. 129:           #define     duty5green  dutys[13]
  136. 130:           #define     duty5blue   dutys[14]    
  137. 131:           #define     duty6red    dutys[15]
  138. 132:           #define     duty6green  dutys[16]    
  139. 133:           #define     duty6blue   dutys[17]
  140. 134:           #define     duty7red    dutys[18]
  141. 135:           #define     duty7green  dutys[19]      
  142. 136:           #define     duty7blue   dutys[20]
  143. 137:           #define     duty8red    dutys[21]
  144. 138:           #define     duty8green  dutys[22]
  145. 139:           #define     duty8blue   dutys[23]
  146. 140:           #define     duty9red    dutys[24]
  147. 141:           #define     duty9green  dutys[25]
  148. 142:           #define     duty9blue   dutys[26]
  149. 143:          
  150. 144:           unsigned char anchodepulso=0;
  151. 145:           unsigned char dutys[27] = { 245,100,100,
  152. 146:                                       10,10,10,
  153. 147:                                       10,10,10,
  154. 148:                                       10,10,10,
  155. 149:                                       10,10,10,
  156. 150:                                       10,150,10,
  157. 151:                                       10,10,10,
  158. 152:                                       10,10,10,
  159. 153:                                       100,100,100
  160. 154:           };
  161. 155:          
  162. 156:           void interrupt YourHighPriorityISRCode(){
  163. 0008  CFFA     MOVFF PCLATH, 0x12
  164. 00A8  CFEA     MOVFF FSR0H, 0x15
  165. 00AA  F015     NOP
  166. 00AC  CFE1     MOVFF FSR1, 0x16
  167. 00AE  F016     NOP
  168. 00B0  CFE2     MOVFF FSR1H, 0x17
  169. 00B2  F017     NOP
  170. 00B4  CFD9     MOVFF FSR2, 0x18
  171. 00B6  F018     NOP
  172. 00B8  CFDA     MOVFF FSR2H, 0x19
  173. 00BA  F019     NOP
  174. 00BC  CFF3     MOVFF PROD, 0x1A
  175. 00BE  F01A     NOP
  176. 00C0  CFF4     MOVFF PRODH, 0x1B
  177. 00C2  F01B     NOP
  178. 00C4  CFF6     MOVFF TBLPTR, 0x1C
  179. 00C6  F01C     NOP
  180. 00C8  CFF7     MOVFF TBLPTRH, 0x1D
  181. 00CA  F01D     NOP
  182. 00CC  CFF8     MOVFF TBLPTRU, 0x1E
  183. 00CE  F01E     NOP
  184. 00D0  CFF5     MOVFF TABLAT, 0x1F
  185. 00D2  F01F     NOP
  186. 157:               if(INTCONbits.TMR0IF){
  187. 00D4  A4F2     BTFSS INTCON, 2, ACCESS
  188. 00D6  D0DE     BRA 0x294
  189. 158:                   anchodepulso++;
  190. 00D8  2A3B     INCF anchodepulso, F, ACCESS
  191. 159:          
  192. 160:                   if(anchodepulso<=duty1red){
  193. 00DA  503B     MOVF anchodepulso, W, ACCESS
  194. 00DC  5C20     SUBWF dutys, W, ACCESS
  195. 00DE  A0D8     BTFSS STATUS, 0, ACCESS
  196. 00E0  D002     BRA 0xE6
  197. 161:                       led1red=1;
  198. 00E2  8889     BSF LATA, 4, ACCESS
  199. 162:                   }else led1red=0;
  200. 00E4  D002     BRA 0xEA
  201. 00E6  9889     BCF LATA, 4, ACCESS
  202. 00E8  D000     BRA 0xEA
  203. 163:            
  204. 164:                   if(anchodepulso<=duty1green){
  205. 00EA  503B     MOVF anchodepulso, W, ACCESS
  206. 00EC  5C21     SUBWF 0x21, W, ACCESS
  207. 00EE  A0D8     BTFSS STATUS, 0, ACCESS
  208. 00F0  D002     BRA 0xF6
  209. 165:                       led1green=1;
  210. 00F2  8A89     BSF LATA, 5, ACCESS
  211. 166:                   }else led1green=0;
  212. 00F4  D002     BRA 0xFA
  213. 00F6  9A89     BCF LATA, 5, ACCESS
  214. 00F8  D000     BRA 0xFA
  215. 167:                    if(anchodepulso<=duty1blue){
  216. 00FA  503B     MOVF anchodepulso, W, ACCESS
  217. 00FC  5C22     SUBWF 0x22, W, ACCESS
  218. 00FE  A0D8     BTFSS STATUS, 0, ACCESS
  219. 0100  D002     BRA 0x106
  220. 168:                       led1blue=1;
  221. 0102  808D     BSF LATE, 0, ACCESS
  222. 169:                   }else led1blue=0;  
  223. 0104  D002     BRA 0x10A
  224. 0106  908D     BCF LATE, 0, ACCESS
  225. 0108  D000     BRA 0x10A
  226. 170:                  
  227. 171:                   if(anchodepulso<=duty2red){
  228. 010A  503B     MOVF anchodepulso, W, ACCESS
  229. 010C  5C23     SUBWF 0x23, W, ACCESS
  230. 010E  A0D8     BTFSS STATUS, 0, ACCESS
  231. 0110  D002     BRA 0x116
  232. 172:                       led2red=1;
  233. 0112  828D     BSF LATE, 1, ACCESS
  234. 173:                   }else led2red=0;
  235. 0114  D002     BRA 0x11A
  236. 0116  928D     BCF LATE, 1, ACCESS
  237. 0118  D000     BRA 0x11A
  238. 174:                   if(anchodepulso<=duty2green){
  239. 011A  503B     MOVF anchodepulso, W, ACCESS
  240. 011C  5C24     SUBWF 0x24, W, ACCESS
  241. 011E  A0D8     BTFSS STATUS, 0, ACCESS
  242. 0120  D002     BRA 0x126
  243. 175:                       led2green=1;
  244. 0122  848D     BSF LATE, 2, ACCESS
  245. 176:                   }else led2green=0;
  246. 0124  D002     BRA 0x12A
  247. 0126  948D     BCF LATE, 2, ACCESS
  248. 0128  D000     BRA 0x12A
  249. 177:                   if(anchodepulso<=duty2blue){
  250. 012A  503B     MOVF anchodepulso, W, ACCESS
  251. 012C  5C25     SUBWF 0x25, W, ACCESS
  252. 012E  A0D8     BTFSS STATUS, 0, ACCESS
  253. 0130  D002     BRA 0x136
  254. 178:                       led2blue=1;
  255. 0132  8E89     BSF LATA, 7, ACCESS
  256. 179:                   }else led2blue=0;
  257. 0134  D002     BRA 0x13A
  258. 0136  9E89     BCF LATA, 7, ACCESS
  259. 0138  D000     BRA 0x13A
  260. 180:                  
  261. 181:                   if(anchodepulso<=duty3red){
  262. 013A  503B     MOVF anchodepulso, W, ACCESS
  263. 013C  5C26     SUBWF 0x26, W, ACCESS
  264. 013E  A0D8     BTFSS STATUS, 0, ACCESS
  265. 0140  D002     BRA 0x146
  266. 182:                       led3red=1;
  267. 0142  8C89     BSF LATA, 6, ACCESS
  268. 183:                   }else led3red=0;
  269. 0144  D002     BRA 0x14A
  270. 0146  9C89     BCF LATA, 6, ACCESS
  271. 0148  D000     BRA 0x14A
  272. 184:                   if(anchodepulso<=duty3green){
  273. 014A  503B     MOVF anchodepulso, W, ACCESS
  274. 014C  5C27     SUBWF 0x27, W, ACCESS
  275. 014E  A0D8     BTFSS STATUS, 0, ACCESS
  276. 0150  D002     BRA 0x156
  277. 185:                       led3green=1;
  278. 0152  808B     BSF LATC, 0, ACCESS
  279. 186:                   }else led3green=0;
  280. 0154  D002     BRA 0x15A
  281. 0156  908B     BCF LATC, 0, ACCESS
  282. 0158  D000     BRA 0x15A
  283. 187:                   if(anchodepulso<=duty3blue){
  284. 015A  503B     MOVF anchodepulso, W, ACCESS
  285. 015C  5C28     SUBWF 0x28, W, ACCESS
  286. 015E  A0D8     BTFSS STATUS, 0, ACCESS
  287. 0160  D002     BRA 0x166
  288. 188:                       led3blue=1;
  289. 0162  828B     BSF LATC, 1, ACCESS
  290. 189:                   }else led3blue=0;
  291. 0164  D002     BRA 0x16A
  292. 0166  928B     BCF LATC, 1, ACCESS
  293. 0168  D000     BRA 0x16A
  294. 190:                  
  295. 191:                   if(anchodepulso<=duty4red){
  296. 016A  503B     MOVF anchodepulso, W, ACCESS
  297. 016C  5C29     SUBWF 0x29, W, ACCESS
  298. 016E  A0D8     BTFSS STATUS, 0, ACCESS
  299. 0170  D002     BRA 0x176
  300. 192:                       led4red=1;
  301. 0172  848B     BSF LATC, 2, ACCESS
  302. 193:                   }else led4red=0;
  303. 0174  D002     BRA 0x17A
  304. 0176  948B     BCF LATC, 2, ACCESS
  305. 0178  D000     BRA 0x17A
  306. 194:                   if(anchodepulso<=duty4green){
  307. 017A  503B     MOVF anchodepulso, W, ACCESS
  308. 017C  5C2A     SUBWF 0x2A, W, ACCESS
  309. 017E  A0D8     BTFSS STATUS, 0, ACCESS
  310. 0180  D002     BRA 0x186
  311. 195:                       led4green=1;
  312. 0182  868B     BSF LATC, 3, ACCESS
  313. 196:                   }else led4green=0;
  314. 0184  D002     BRA 0x18A
  315. 0186  968B     BCF LATC, 3, ACCESS
  316. 0188  D000     BRA 0x18A
  317. 197:                   if(anchodepulso<=duty4blue){
  318. 018A  503B     MOVF anchodepulso, W, ACCESS
  319. 018C  5C2B     SUBWF 0x2B, W, ACCESS
  320. 018E  A0D8     BTFSS STATUS, 0, ACCESS
  321. 0190  D002     BRA 0x196
  322. 198:                       led4blue=1;
  323. 0192  808C     BSF LATD, 0, ACCESS
  324. 199:                   }else led4blue=0;
  325. 0194  D002     BRA 0x19A
  326. 0196  908C     BCF LATD, 0, ACCESS
  327. 0198  D000     BRA 0x19A
  328. 200:                  
  329. 201:                   if(anchodepulso<=duty5red){
  330. 019A  503B     MOVF anchodepulso, W, ACCESS
  331. 019C  5C2C     SUBWF 0x2C, W, ACCESS
  332. 019E  A0D8     BTFSS STATUS, 0, ACCESS
  333. 01A0  D002     BRA 0x1A6
  334. 202:                       led5red=1;
  335. 01A2  828C     BSF LATD, 1, ACCESS
  336. 203:                   }else led5red=0;
  337. 01A4  D002     BRA 0x1AA
  338. 01A6  928C     BCF LATD, 1, ACCESS
  339. 01A8  D000     BRA 0x1AA
  340. 204:                   if(anchodepulso<=duty5green){
  341. 01AA  503B     MOVF anchodepulso, W, ACCESS
  342. 01AC  5C2D     SUBWF 0x2D, W, ACCESS
  343. 01AE  A0D8     BTFSS STATUS, 0, ACCESS
  344. 01B0  D002     BRA 0x1B6
  345. 205:                       led5green=1;
  346. 01B2  848C     BSF LATD, 2, ACCESS
  347. 206:                   }else led5green=0;
  348. 01B4  D002     BRA 0x1BA
  349. 01B6  948C     BCF LATD, 2, ACCESS
  350. 01B8  D000     BRA 0x1BA
  351. 207:                   if(anchodepulso<=duty5blue){
  352. 01BA  503B     MOVF anchodepulso, W, ACCESS
  353. 01BC  5C2E     SUBWF 0x2E, W, ACCESS
  354. 01BE  A0D8     BTFSS STATUS, 0, ACCESS
  355. 01C0  D002     BRA 0x1C6
  356. 208:                       led5blue=1;
  357. 01C2  868C     BSF LATD, 3, ACCESS
  358. 209:                   }else led5blue=0;
  359. 01C4  D002     BRA 0x1CA
  360. 01C6  968C     BCF LATD, 3, ACCESS
  361. 01C8  D000     BRA 0x1CA
  362. 210:                  
  363. 211:                   if(anchodepulso<=duty6red){
  364. 01CA  503B     MOVF anchodepulso, W, ACCESS
  365. 01CC  5C2F     SUBWF 0x2F, W, ACCESS
  366. 01CE  A0D8     BTFSS STATUS, 0, ACCESS
  367. 01D0  D002     BRA 0x1D6
  368. 212:                       led6red=1;
  369. 01D2  888B     BSF LATC, 4, ACCESS
  370. 213:                   }else led6red=0;
  371. 01D4  D002     BRA 0x1DA
  372. 01D6  988B     BCF LATC, 4, ACCESS
  373. 01D8  D000     BRA 0x1DA
  374. 214:                   if(anchodepulso<=duty6green){
  375. 01DA  503B     MOVF anchodepulso, W, ACCESS
  376. 01DC  5C30     SUBWF 0x30, W, ACCESS
  377. 01DE  A0D8     BTFSS STATUS, 0, ACCESS
  378. 01E0  D002     BRA 0x1E6
  379. 215:                       led6green=1;
  380. 01E2  8C8B     BSF LATC, 6, ACCESS
  381. 216:                   }else led6green=0;
  382. 01E4  D002     BRA 0x1EA
  383. 01E6  9C8B     BCF LATC, 6, ACCESS
  384. 01E8  D000     BRA 0x1EA
  385. 217:                   if(anchodepulso<=duty6blue){
  386. 01EA  503B     MOVF anchodepulso, W, ACCESS
  387. 01EC  5C31     SUBWF 0x31, W, ACCESS
  388. 01EE  A0D8     BTFSS STATUS, 0, ACCESS
  389. 01F0  D002     BRA 0x1F6
  390. 218:                       led6blue=1;
  391. 01F2  888C     BSF LATD, 4, ACCESS
  392. 219:                   }else led6blue=0;
  393. 01F4  D002     BRA 0x1FA
  394. 01F6  988C     BCF LATD, 4, ACCESS
  395. 01F8  D000     BRA 0x1FA
  396. 220:                  
  397. 221:                   if(anchodepulso<=duty7red){
  398. 01FA  503B     MOVF anchodepulso, W, ACCESS
  399. 01FC  5C32     SUBWF 0x32, W, ACCESS
  400. 01FE  A0D8     BTFSS STATUS, 0, ACCESS
  401. 0200  D002     BRA 0x206
  402. 222:                       led7red=1;
  403. 0202  8A8C     BSF LATD, 5, ACCESS
  404. 223:                   }else led7red=0;
  405. 0204  D002     BRA 0x20A
  406. 0206  9A8C     BCF LATD, 5, ACCESS
  407. 0208  D000     BRA 0x20A
  408. 224:                   if(anchodepulso<=duty7green){
  409. 020A  503B     MOVF anchodepulso, W, ACCESS
  410. 020C  5C33     SUBWF 0x33, W, ACCESS
  411. 020E  A0D8     BTFSS STATUS, 0, ACCESS
  412. 0210  D002     BRA 0x216
  413. 225:                       led7green=1;
  414. 0212  8C8C     BSF LATD, 6, ACCESS
  415. 226:                   }else led7green=0;
  416. 0214  D002     BRA 0x21A
  417. 0216  9C8C     BCF LATD, 6, ACCESS
  418. 0218  D000     BRA 0x21A
  419. 227:                   if(anchodepulso<=duty7blue){
  420. 021A  503B     MOVF anchodepulso, W, ACCESS
  421. 021C  5C34     SUBWF 0x34, W, ACCESS
  422. 021E  A0D8     BTFSS STATUS, 0, ACCESS
  423. 0220  D002     BRA 0x226
  424. 228:                       led7blue=1;
  425. 0222  8E8C     BSF LATD, 7, ACCESS
  426. 229:                   }else led7blue=0;
  427. 0224  D002     BRA 0x22A
  428. 0226  9E8C     BCF LATD, 7, ACCESS
  429. 0228  D000     BRA 0x22A
  430. 230:                  
  431. 231:                   if(anchodepulso<=duty8red){
  432. 022A  503B     MOVF anchodepulso, W, ACCESS
  433. 022C  5C35     SUBWF 0x35, W, ACCESS
  434. 022E  A0D8     BTFSS STATUS, 0, ACCESS
  435. 0230  D002     BRA 0x236
  436. 232:                       led8red=1;
  437. 0232  808A     BSF LATB, 0, ACCESS
  438. 233:                   }else led8red=0;
  439. 0234  D002     BRA 0x23A
  440. 0236  908A     BCF LATB, 0, ACCESS
  441. 0238  D000     BRA 0x23A
  442. 234:                   if(anchodepulso<=duty8green){
  443. 023A  503B     MOVF anchodepulso, W, ACCESS
  444. 023C  5C36     SUBWF 0x36, W, ACCESS
  445. 023E  A0D8     BTFSS STATUS, 0, ACCESS
  446. 0240  D002     BRA 0x246
  447. 235:                       led8green=1;
  448. 0242  828A     BSF LATB, 1, ACCESS
  449. 236:                   }else led8green=0;
  450. 0244  D002     BRA 0x24A
  451. 0246  928A     BCF LATB, 1, ACCESS
  452. 0248  D000     BRA 0x24A
  453. 237:                   if(anchodepulso<=duty8blue){
  454. 024A  503B     MOVF anchodepulso, W, ACCESS
  455. 024C  5C37     SUBWF 0x37, W, ACCESS
  456. 024E  A0D8     BTFSS STATUS, 0, ACCESS
  457. 0250  D002     BRA 0x256
  458. 238:                       led8blue=1;
  459. 0252  848A     BSF LATB, 2, ACCESS
  460. 239:                   }else led8blue=0;
  461. 0254  D002     BRA 0x25A
  462. 0256  948A     BCF LATB, 2, ACCESS
  463. 0258  D000     BRA 0x25A
  464. 240:                  
  465. 241:                   if(anchodepulso<=duty9red){
  466. 025A  503B     MOVF anchodepulso, W, ACCESS
  467. 025C  5C38     SUBWF 0x38, W, ACCESS
  468. 025E  A0D8     BTFSS STATUS, 0, ACCESS
  469. 0260  D002     BRA 0x266
  470. 242:                       led9red=1;
  471. 0262  868A     BSF LATB, 3, ACCESS
  472. 243:                   }else led9red=0;
  473. 0264  D002     BRA 0x26A
  474. 0266  968A     BCF LATB, 3, ACCESS
  475. 0268  D000     BRA 0x26A
  476. 244:                   if(anchodepulso<=duty9green){
  477. 026A  503B     MOVF anchodepulso, W, ACCESS
  478. 026C  5C39     SUBWF 0x39, W, ACCESS
  479. 026E  A0D8     BTFSS STATUS, 0, ACCESS
  480. 0270  D002     BRA 0x276
  481. 245:                       led9green=1;
  482. 0272  888A     BSF LATB, 4, ACCESS
  483. 246:                   }else led9green=0;
  484. 0274  D002     BRA 0x27A
  485. 0276  988A     BCF LATB, 4, ACCESS
  486. 0278  D000     BRA 0x27A
  487. 247:                   if(anchodepulso<=duty9blue){
  488. 027A  503B     MOVF anchodepulso, W, ACCESS
  489. 027C  5C3A     SUBWF 0x3A, W, ACCESS
  490. 027E  A0D8     BTFSS STATUS, 0, ACCESS
  491. 0280  D002     BRA 0x286
  492. 248:                       led9blue=1;
  493. 0282  8A8A     BSF LATB, 5, ACCESS
  494. 249:                   }else led9blue=0;
  495. 0284  D002     BRA 0x28A
  496. 0286  9A8A     BCF LATB, 5, ACCESS
  497. 0288  D000     BRA 0x28A
  498. 250:                   if(anchodepulso==255){
  499. 251:                       anchodepulso==0;
  500. 252:                   }
  501. 253:                   INTCONbits.TMR0IF=0;
  502. 028A  94F2     BCF INTCON, 2, ACCESS
  503. 254:                   TMR0H = 0;
  504. 028C  0E00     MOVLW 0x0
  505. 028E  6ED7     MOVWF TMR0H, ACCESS
  506. 255:                   TMR0L= 255;
  507. 0290  68D6     SETF TMR0, ACCESS
  508. 0292  D000     BRA 0x294
  509. 256:               }    
  510. 257:               INTCONbits.GIEH = 1; //IMPORTANTE HABILITARLAS PORQ SE DESHABILITAN CON INTERRUP
  511. 0294  8EF2     BSF INTCON, 7, ACCESS
  512. 258:           }
  513. 0296  C01F     MOVFF 0x1F, TABLAT
  514. 259:          
  515. 260:           void interrupt low_priority YourLowPriorityISRCode(){
  516. 0018  CFD8     MOVFF STATUS, 0x1
  517. 261:          
  518. 262:               INTCONbits.GIEL = 1;//IMPORTANTE HABILITARLAS PORQ SE DESHABILITAN CON INTERRUP
  519. 005C  8CF2     BSF INTCON, 6, ACCESS
  520. 263:           }
  521. 0008  CFFA     MOVFF PCLATH, 0x12
  522. 000A  F012     NOP
  523. 000C  CFFB     MOVFF PCLATU, 0x13
  524. 000E  F013     NOP
  525. 0010  CFE9     MOVFF FSR0, 0x14
  526. 0012  F014     NOP
  527. 0014  EF54     GOTO 0xA8
  528. 0016  F000     NOP
  529. 005E  C011     MOVFF 0x11, TABLAT
  530. 264:          
  531. 265:          
  532. 266:           void main(void) {
  533. 267:              
  534. 268:               OSCCONbits.IDLEN=0;
  535. 02D0  9ED3     BCF OSCCON, 7, ACCESS
  536. 269:               OSCCONbits.IRCF =0b111; //oscilador interno de 16Mhz
  537. 02D2  88D3     BSF OSCCON, 4, ACCESS
  538. 02D4  8AD3     BSF OSCCON, 5, ACCESS
  539. 02D6  8CD3     BSF OSCCON, 6, ACCESS
  540. 270:               while(OSCCONbits.OSTS); // sino esta corriendo con oscilador interno quedarse aca
  541. 02D8  D000     BRA 0x2DA
  542. 02DA  A6D3     BTFSS OSCCON, 3, ACCESS
  543. 02DC  D002     BRA 0x2E2
  544. 02DE  D7FD     BRA 0x2DA
  545. 271:               while(!OSCCONbits.IOFS); // espera que frecuencia del clok sea estable
  546. 02E0  D000     BRA 0x2E2
  547. 02E2  A4D3     BTFSS OSCCON, 2, ACCESS
  548. 02E4  D7FE     BRA 0x2E2
  549. 272:               OSCCONbits.SCS = 0b11; // clock del sistema sea interno
  550. 02E6  0E03     MOVLW 0x3
  551. 02E8  12D3     IORWF OSCCON, F, ACCESS
  552. 273:               OSCTUNEbits.INTSRC=1;
  553. 02EA  8E9B     BSF OSCTUNE, 7, ACCESS
  554. 274:               OSCTUNEbits.PLLEN= 1; //habilito PLL osea que en 16Mhz con PLL DE 4 --> Fosc= 64MHz
  555. 02EC  8C9B     BSF OSCTUNE, 6, ACCESS
  556. 275:               OSCTUNEbits.TUN= 0; //oscilador funcione calibrado de fabrica
  557. 02EE  909B     BCF OSCTUNE, 0, ACCESS
  558. 02F0  929B     BCF OSCTUNE, 1, ACCESS
  559. 02F2  949B     BCF OSCTUNE, 2, ACCESS
  560. 02F4  969B     BCF OSCTUNE, 3, ACCESS
  561. 02F6  989B     BCF OSCTUNE, 4, ACCESS
  562. 02F8  9A9B     BCF OSCTUNE, 5, ACCESS
  563. 276:              
  564. 277:               INTCONbits.TMR0IE=0;
  565. 02FA  9AF2     BCF INTCON, 5, ACCESS
  566. 278:               INTCONbits.INT0IE = 0;
  567. 02FC  98F2     BCF INTCON, 4, ACCESS
  568. 279:               INTCONbits.RBIE = 0;
  569. 02FE  96F2     BCF INTCON, 3, ACCESS
  570. 280:               INTCONbits.PEIE_GIEL=1;
  571. 0300  8CF2     BSF INTCON, 6, ACCESS
  572. 281:               INTCONbits.GIE_GIEH=1;
  573. 0302  8EF2     BSF INTCON, 7, ACCESS
  574. 282:              
  575. 283:               INTCON2bits.RBPU=0;
  576. 0304  9EF1     BCF INTCON2, 7, ACCESS
  577. 284:               INTCON2bits.TMR0IP=0;
  578. 0306  94F1     BCF INTCON2, 2, ACCESS
  579. 285:               INTCON2bits.RBIP=0;
  580. 0308  90F1     BCF INTCON2, 0, ACCESS
  581. 286:              
  582. 287:               INTCON3bits.INT2E=0;
  583. 030A  98F0     BCF INTCON3, 4, ACCESS
  584. 288:               INTCON3bits.INT1E=0;
  585. 030C  96F0     BCF INTCON3, 3, ACCESS
  586. 289:               INTCON3bits.INT1IP=0;
  587. 030E  9CF0     BCF INTCON3, 6, ACCESS
  588. 290:               INTCON3bits.INT2IP=0;
  589. 0310  9EF0     BCF INTCON3, 7, ACCESS
  590. 291:              
  591. 292:               PIE1bits.ADIE=0;
  592. 0312  9C9D     BCF PIE1, 6, ACCESS
  593. 293:               PIE1bits.PSPIE=0;
  594. 0314  9E9D     BCF PIE1, 7, ACCESS
  595. 294:               PIE1bits.RCIE=0; //INT DEL EUSART
  596. 0316  9A9D     BCF PIE1, 5, ACCESS
  597. 295:               PIE1bits.TXIE=0; //INT DEL EUSART
  598. 0318  989D     BCF PIE1, 4, ACCESS
  599. 296:               PIE1bits.CCP1IE=0;
  600. 031A  949D     BCF PIE1, 2, ACCESS
  601. 297:               PIE1bits.TMR1IE=0;
  602. 031C  909D     BCF PIE1, 0, ACCESS
  603. 298:               PIE1bits.TMR2IE=0;
  604. 031E  929D     BCF PIE1, 1, ACCESS
  605. 299:              
  606. 300:               PIE2bits.BCLIE=0;
  607. 0320  96A0     BCF PIE2, 3, ACCESS
  608. 301:               PIE2bits.C1IE=0;
  609. 0322  9CA0     BCF PIE2, 6, ACCESS
  610. 302:               PIE2bits.C2IE=0;
  611. 0324  9AA0     BCF PIE2, 5, ACCESS
  612. 303:               PIE2bits.EEIE=0;
  613. 0326  98A0     BCF PIE2, 4, ACCESS
  614. 304:               PIE2bits.HLVDIE=0;
  615. 0328  94A0     BCF PIE2, 2, ACCESS
  616. 305:               PIE2bits.TMR3IE=0;
  617. 032A  92A0     BCF PIE2, 1, ACCESS
  618. 306:               PIE2bits.CCP2IE=0;
  619. 032C  90A0     BCF PIE2, 0, ACCESS
  620. 307:              
  621. 308:               TRISB = 0b00000000; // 6 PWM DOS OCUPADOS POR PROGRAMACION RB6 Y RB7
  622. 032E  0E00     MOVLW 0x0
  623. 0330  6E93     MOVWF TRISB, ACCESS
  624. 309:               TRISC = 0b10000000; // 6 PWM DOS OCUPADOS POR USART RC6 Y RC7
  625. 0332  0E80     MOVLW 0x80
  626. 0334  6E94     MOVWF TRISC, ACCESS
  627. 310:               TRISD = 0b00000000; // 8 PWM
  628. 0336  0E00     MOVLW 0x0
  629. 0338  6E95     MOVWF TRISD, ACCESS
  630. 311:               TRISE = 0b1000;     // 3 PWM  RE3 ES MCLR
  631. 033A  0E08     MOVLW 0x8
  632. 033C  6E96     MOVWF TRISE, ACCESS
  633. 312:               TRISA = 0b00000011; // 4 PWM , SOBRAN 4 ADC RA0  RA1 RA2 Y RA3
  634. 033E  0E03     MOVLW 0x3
  635. 0340  6E92     MOVWF TRISA, ACCESS
  636. 313:              
  637. 314:               T0CONbits.T08BIT = 1;
  638. 0342  8CD5     BSF T0CON, 6, ACCESS
  639. 315:               T0CONbits.T0CS=0;
  640. 0344  9AD5     BCF T0CON, 5, ACCESS
  641. 316:               T0CONbits.PSA= 1; // SIN PRESCALER OSEA PRESCALER =1
  642. 0346  86D5     BSF T0CON, 3, ACCESS
  643. 317:               TMR0L= 244; // desborda cada 75uS , cuando llega a 100 veces cumple un periodo de 13,333 KHz
  644. 0348  0EF4     MOVLW 0xF4
  645. 034A  6ED6     MOVWF TMR0, ACCESS
  646. 318:               INTCONbits.TMR0IE=1;
  647. 034C  8AF2     BSF INTCON, 5, ACCESS
  648. 319:              
  649. 320:               while(1){
  650. 321:                  
  651. 322:               }
  652. 034E  D7FF     BRA 0x34E
  653. 323:           }
  654. 0018  CFD8     MOVFF STATUS, 0x1
  655. 001A  F001     NOP
  656. 001C  CFE8     MOVFF WREG, 0x2
  657. 001E  F002     NOP
  658. 0020  CFE0     MOVFF BSR, 0x3
  659. 0022  F003     NOP
  660. 0024  CFFA     MOVFF PCLATH, 0x4
  661. 0026  F004     NOP
  662. 0028  CFFB     MOVFF PCLATU, 0x5
  663. 002A  F005     NOP
  664. 002C  CFE9     MOVFF FSR0, 0x6
  665. 002E  F006     NOP
  666. 0030  CFEA     MOVFF FSR0H, 0x7
  667. 0032  F007     NOP
  668. 0034  CFE1     MOVFF FSR1, 0x8
  669. 0036  F008     NOP
  670. 0038  CFE2     MOVFF FSR1H, 0x9
  671. 003A  F009     NOP
  672. 003C  CFD9     MOVFF FSR2, 0xA
  673. 003E  F00A     NOP
  674. 0040  CFDA     MOVFF FSR2H, 0xB
  675. 0042  F00B     NOP
  676. 0044  CFF3     MOVFF PROD, 0xC
  677. 0046  F00C     NOP
  678. 0048  CFF4     MOVFF PRODH, 0xD
  679. 004A  F00D     NOP
  680. 004C  CFF6     MOVFF TBLPTR, 0xE
  681. 004E  F00E     NOP
  682. 0050  CFF7     MOVFF TBLPTRH, 0xF
  683. 0052  F00F     NOP
  684. 0054  CFF8     MOVFF TBLPTRU, 0x10
  685. 0056  F010     NOP
  686. 0058  CFF5     MOVFF TABLAT, 0x11
  687. 005A  F011     NOP
  688. 0350  EF52     GOTO 0xA4
  689. 324:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement