Advertisement
RuiViana

PLL PIC16F628A

Aug 24th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.43 KB | None | 0 0
  1. ; Ladeni SAA1057 s PIC16F84
  2. ; -------------------------
  3. ; (C) 1999-2001 Piratske radio - www.pira.cz
  4. ;
  5. ; Verze 5 - opakovany upload v danem intervalu
  6. ; Pro assembler MPASM - www.microchip.com
  7. ;
  8. ; Zapojeni: DAT 3 (OUT)
  9. ; DLEN 2 (OUT) TUNED 18 (OUT)
  10. ; CLB 1 (OUT) jumpery 6-13 (IN)
  11.  
  12. LIST p=16F628 ;tell assembler what chip we are using
  13. INCLUDE "P16F628A.INC" ;include the defaults for the chip
  14. ERRORLEVEL 0, -302 ;suppress bank selection messages
  15.  
  16. __CONFIG _BODEN_ON & _CP_OFF & _PWRTE_ON & _WDT_ON & _LVP_OFF & _MCLRE_ON & _RC_OSC_CLKOUT
  17. ; __CONFIG _BODEN_ON & _CP_OFF & _PWRTE_ON & _WDT_ON & _LVP_OFF & _MCLRE_ON & _INTOSC_OSC_CLKOUT
  18.  
  19. #DEFINE BANK0 BCF STATUS,RP0 ;SETA BANK 0 DE MEMÓRIA
  20. #DEFINE BANK1 BSF STATUS,RP0 ;SETA BANK 1 DE MAMÓRIA
  21.  
  22.  
  23.  
  24. CBLOCK 0x20 ;start of general purpose registers
  25. COUNT
  26. WORKA
  27. WORKB
  28. CNT1
  29. CNT2
  30. CNT3
  31. ENDC
  32.  
  33. DAT EQU 4
  34. DLEN EQU 3
  35. CLB EQU 2
  36. TUNED EQU 1
  37.  
  38. INICIO
  39. CLRWDT
  40. BCF PORTA,TUNED
  41. BSF STATUS,5
  42. CLRF TRISA
  43. MOVLW B'01111111'
  44. MOVWF OPTION_REG ;pull-ups and WDT on
  45. BCF STATUS,5
  46.  
  47. START CLRWDT
  48. CLRF PORTA
  49. CLRF COUNT
  50. MOVLW B'00100000'
  51. MOVWF WORKA
  52. MOVLW B'00111010'
  53. MOVWF WORKB
  54. SOUCET CLRWDT
  55. MOVF PORTB,W
  56. BCF STATUS,C
  57. ADDWF WORKB,f
  58. BTFSC STATUS,C
  59. INCF WORKA
  60. INCF COUNT
  61. MOVLW 0Ah
  62. SUBWF COUNT,W
  63. BTFSS STATUS,Z
  64. GOTO SOUCET
  65. MOVLW 0xFF
  66. MOVWF COUNT
  67.  
  68. ZNOVA CLRWDT
  69. CALL PULS
  70. CALL PULS
  71. CALL PULS
  72. CALL PULS
  73. CALL PULS
  74. CALL PULS
  75. CALL PULS
  76. CALL PULS
  77. CALL PULS
  78. CALL PULS
  79. CALL PULS
  80. CALL PULS
  81. CALL PULS
  82. CALL PULS ;14 PULZU NA CLB
  83. BCF PORTA,DAT
  84. BSF PORTA,DLEN ;DLEN 1
  85. CALL PULS ;0
  86. BSF PORTA,DAT
  87. CALL PULS ;1
  88. CALL PULS ;2
  89. BCF PORTA,DAT
  90. CALL PULS ;3
  91. BSF PORTA,DAT
  92. CALL PULS ;4
  93. CALL PULS ;5
  94. CALL PULS ;6
  95. BCF PORTA,DAT
  96. CALL PULS ;7
  97. BSF PORTA,DAT
  98. CALL PULS ;8
  99. BTFSS COUNT,7
  100. BSF PORTA,DAT
  101. BTFSC COUNT,7
  102. BCF PORTA,DAT
  103. CALL PULS ;9
  104. BCF PORTA,DAT
  105. CALL PULS ;10
  106. CALL PULS ;11
  107. CALL PULS ;12
  108. CALL PULS ;13
  109. BSF PORTA,DAT
  110. CALL PULS ;14
  111. BCF PORTA,DAT
  112. CALL PULS ;15
  113. BSF PORTA,DAT
  114. CALL PULS ;16
  115. BCF PORTA,DAT
  116. BCF PORTA,DLEN
  117. CALL PULS
  118. NOP
  119. NOP
  120. NOP
  121. BSF PORTA,DLEN
  122. CALL PULS ;0
  123. CALL PULS ;1
  124. CALL PULS ;2
  125. BSF PORTA,DAT
  126. CALL PULS ;3
  127. BCF PORTA,DAT
  128. CALL PULS ;4
  129. BTFSS WORKA,3
  130. BCF PORTA,DAT
  131. BTFSC WORKA,3
  132. BSF PORTA,DAT
  133. CALL PULS ;5
  134. BTFSS WORKA,2
  135. BCF PORTA,DAT
  136. BTFSC WORKA,2
  137. BSF PORTA,DAT
  138. CALL PULS ;6
  139. BTFSS WORKA,1
  140. BCF PORTA,DAT
  141. BTFSC WORKA,1
  142. BSF PORTA,DAT
  143. CALL PULS ;7
  144. BTFSS WORKA,0
  145. BCF PORTA,DAT
  146. BTFSC WORKA,0
  147. BSF PORTA,DAT
  148. CALL PULS ;8
  149. BTFSS WORKB,7
  150. BCF PORTA,DAT
  151. BTFSC WORKB,7
  152. BSF PORTA,DAT
  153. CALL PULS ;9
  154. BTFSS WORKB,6
  155. BCF PORTA,DAT
  156. BTFSC WORKB,6
  157. BSF PORTA,DAT
  158. CALL PULS ;10
  159. BTFSS WORKB,5
  160. BCF PORTA,DAT
  161. BTFSC WORKB,5
  162. BSF PORTA,DAT
  163. CALL PULS ;11
  164. BTFSS WORKB,4
  165. BCF PORTA,DAT
  166. BTFSC WORKB,4
  167. BSF PORTA,DAT
  168. CALL PULS ;12
  169. BTFSS WORKB,3
  170. BCF PORTA,DAT
  171. BTFSC WORKB,3
  172. BSF PORTA,DAT
  173. CALL PULS ;13
  174. BTFSS WORKB,2
  175. BCF PORTA,DAT
  176. BTFSC WORKB,2
  177. BSF PORTA,DAT
  178. CALL PULS ;14
  179. BTFSS WORKB,1
  180. BCF PORTA,DAT
  181. BTFSC WORKB,1
  182. BSF PORTA,DAT
  183. CALL PULS ;15
  184. BCF PORTA,DAT
  185. CALL PULS ;16
  186. BCF PORTA,DLEN
  187. CALL PULS
  188. INCF COUNT
  189. NOP
  190. NOP
  191. NOP
  192. BTFSS COUNT,3
  193. GOTO ZNOVA
  194. BSF PORTA,DLEN ;DLEN 1
  195. CALL PULS ;0
  196. BSF PORTA,DAT
  197. CALL PULS ;1
  198. CALL PULS ;2
  199. BCF PORTA,DAT
  200. CALL PULS ;3
  201. CALL PULS ;4
  202. CALL PULS ;5
  203. CALL PULS ;6
  204. BSF PORTA,DAT
  205. CALL PULS ;7
  206. CALL PULS ;8
  207. CALL PULS ;9
  208. BCF PORTA,DAT
  209. CALL PULS ;10
  210. CALL PULS ;11
  211. CALL PULS ;12
  212. CALL PULS ;13
  213. BSF PORTA,DAT
  214. CALL PULS ;14
  215. BCF PORTA,DAT
  216. CALL PULS ;15
  217. BSF PORTA,DAT
  218. CALL PULS ;16
  219. BCF PORTA,DAT
  220. BCF PORTA,DLEN
  221. CALL PULS
  222. NOP
  223. NOP
  224. NOP
  225. BSF PORTA,DLEN
  226. CALL PULS ;0
  227. CALL PULS ;1
  228. CALL PULS ;2
  229. BSF PORTA,DAT
  230. CALL PULS ;3
  231. BCF PORTA,DAT
  232. CALL PULS ;4
  233. BTFSS WORKA,3
  234. BCF PORTA,DAT
  235. BTFSC WORKA,3
  236. BSF PORTA,DAT
  237. CALL PULS ;5
  238. BTFSS WORKA,2
  239. BCF PORTA,DAT
  240. BTFSC WORKA,2
  241. BSF PORTA,DAT
  242. CALL PULS ;6
  243. BTFSS WORKA,1
  244. BCF PORTA,DAT
  245. BTFSC WORKA,1
  246. BSF PORTA,DAT
  247. CALL PULS ;7
  248. BTFSS WORKA,0
  249. BCF PORTA,DAT
  250. BTFSC WORKA,0
  251. BSF PORTA,DAT
  252. CALL PULS ;8
  253. BTFSS WORKB,7
  254. BCF PORTA,DAT
  255. BTFSC WORKB,7
  256. BSF PORTA,DAT
  257. CALL PULS ;9
  258. BTFSS WORKB,6
  259. BCF PORTA,DAT
  260. BTFSC WORKB,6
  261. BSF PORTA,DAT
  262. CALL PULS ;10
  263. BTFSS WORKB,5
  264. BCF PORTA,DAT
  265. BTFSC WORKB,5
  266. BSF PORTA,DAT
  267. CALL PULS ;11
  268. BTFSS WORKB,4
  269. BCF PORTA,DAT
  270. BTFSC WORKB,4
  271. BSF PORTA,DAT
  272. CALL PULS ;12
  273. BTFSS WORKB,3
  274. BCF PORTA,DAT
  275. BTFSC WORKB,3
  276. BSF PORTA,DAT
  277. CALL PULS ;13
  278. BTFSS WORKB,2
  279. BCF PORTA,DAT
  280. BTFSC WORKB,2
  281. BSF PORTA,DAT
  282. CALL PULS ;14
  283. BTFSS WORKB,1
  284. BCF PORTA,DAT
  285. BTFSC WORKB,1
  286. BSF PORTA,DAT
  287. CALL PULS ;15
  288. BCF PORTA,DAT
  289. CALL PULS ;16
  290. BCF PORTA,DLEN
  291. CALL PULS
  292. ; BSF PORTA,TUNED
  293. CLRF CNT1
  294. CLRF CNT2
  295. CLRF CNT3
  296. CEKANI CLRWDT
  297. INCF CNT1
  298. BTFSS STATUS,Z
  299. GOTO CEKANI2
  300. INCF CNT2
  301. BTFSC STATUS,Z
  302. ; INCF CNT3
  303. ; BSF PORTA,TUNED
  304. CALL LED_ON
  305. CEKANI2 BTFSS CNT3,5 ;CCCCCCCAAA 30 MIN.
  306. GOTO CEKANI
  307. MOVLW 0xFF
  308. MOVWF COUNT
  309. REPEAT CALL PULS
  310. CALL PULS
  311. CALL PULS
  312. CALL PULS
  313. CALL PULS
  314. CALL PULS
  315. CALL PULS
  316. CALL PULS
  317. CALL PULS
  318. CALL PULS
  319. CALL PULS
  320. CALL PULS
  321. CALL PULS
  322. CALL PULS ;14 PULZU NA CLB
  323. BCF PORTA,DAT
  324. BSF PORTA,DLEN ;DLEN 1
  325. CALL PULS ;0
  326. BSF PORTA,DAT
  327. CALL PULS ;1
  328. CALL PULS ;2
  329. BCF PORTA,DAT
  330. CALL PULS ;3
  331. BCF PORTA,DAT
  332. CALL PULS ;4
  333. CALL PULS ;5
  334. CALL PULS ;6
  335. BSF PORTA,DAT
  336. CALL PULS ;7
  337. BSF PORTA,DAT
  338. CALL PULS ;8
  339. BTFSS COUNT,7
  340. BSF PORTA,DAT
  341. BTFSC COUNT,7
  342. BCF PORTA,DAT
  343. CALL PULS ;9
  344. BCF PORTA,DAT
  345. CALL PULS ;10
  346. CALL PULS ;11
  347. CALL PULS ;12
  348. CALL PULS ;13
  349. BSF PORTA,DAT
  350. CALL PULS ;14
  351. BCF PORTA,DAT
  352. CALL PULS ;15
  353. BSF PORTA,DAT
  354. CALL PULS ;16
  355. BCF PORTA,DAT
  356. BCF PORTA,DLEN
  357. CALL PULS
  358. NOP
  359. NOP
  360. NOP
  361. BSF PORTA,DLEN
  362. CALL PULS ;0
  363. CALL PULS ;1
  364. CALL PULS ;2
  365. BSF PORTA,DAT
  366. CALL PULS ;3
  367. BCF PORTA,DAT
  368. CALL PULS ;4
  369. BTFSS WORKA,3
  370. BCF PORTA,DAT
  371. BTFSC WORKA,3
  372. BSF PORTA,DAT
  373. CALL PULS ;5
  374. BTFSS WORKA,2
  375. BCF PORTA,DAT
  376. BTFSC WORKA,2
  377. BSF PORTA,DAT
  378. CALL PULS ;6
  379. BTFSS WORKA,1
  380. BCF PORTA,DAT
  381. BTFSC WORKA,1
  382. BSF PORTA,DAT
  383. CALL PULS ;7
  384. BTFSS WORKA,0
  385. BCF PORTA,DAT
  386. BTFSC WORKA,0
  387. BSF PORTA,DAT
  388. CALL PULS ;8
  389. BTFSS WORKB,7
  390. BCF PORTA,DAT
  391. BTFSC WORKB,7
  392. BSF PORTA,DAT
  393. CALL PULS ;9
  394. BTFSS WORKB,6
  395. BCF PORTA,DAT
  396. BTFSC WORKB,6
  397. BSF PORTA,DAT
  398. CALL PULS ;10
  399. BTFSS WORKB,5
  400. BCF PORTA,DAT
  401. BTFSC WORKB,5
  402. BSF PORTA,DAT
  403. CALL PULS ;11
  404. BTFSS WORKB,4
  405. BCF PORTA,DAT
  406. BTFSC WORKB,4
  407. BSF PORTA,DAT
  408. CALL PULS ;12
  409. BTFSS WORKB,3
  410. BCF PORTA,DAT
  411. BTFSC WORKB,3
  412. BSF PORTA,DAT
  413. CALL PULS ;13
  414. BTFSS WORKB,2
  415. BCF PORTA,DAT
  416. BTFSC WORKB,2
  417. BSF PORTA,DAT
  418. CALL PULS ;14
  419. BTFSS WORKB,1
  420. BCF PORTA,DAT
  421. BTFSC WORKB,1
  422. BSF PORTA,DAT
  423. CALL PULS ;15
  424. BCF PORTA,DAT
  425. CALL PULS ;16
  426. BCF PORTA,DLEN
  427. CALL PULS
  428. NOP
  429. NOP
  430. NOP
  431. INCF COUNT
  432. BTFSS COUNT,3
  433. GOTO REPEAT
  434. CLRF CNT1
  435. CLRF CNT2
  436. CLRF CNT3
  437. GOTO CEKANI
  438. PULS BSF PORTA,CLB
  439. BCF PORTA,CLB
  440. RETURN
  441.  
  442. LED_ON
  443. BSF PORTA,TUNED
  444. INCF CNT3,F
  445. RETURN
  446.  
  447. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement