Advertisement
RuiViana

Assembler PLL

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