Advertisement
aureliocavalitto

RenzoAssembler

Dec 6th, 2021
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. list p=18f4620 r=DEC
  2. #include <p18f4620.inc>
  3.  
  4. leido equ 0x21
  5. entrada equ 0x20
  6.  
  7. config OSC = INTIO67, FCMEN = OFF, IESO = OFF ;// CONFIG1H
  8. config PWRT = OFF, BOREN = OFF, BORV = 0 ;// CONFIG2L
  9. config WDT = OFF, WDTPS = 32768 ;// CONFIG2H
  10. config MCLRE = ON, LPT1OSC = OFF, PBADEN = OFF, CCP2MX = PORTC ;// CONFIG3H
  11. config STVREN = ON, LVP = OFF, XINST = OFF ;// CONFIG4L
  12. config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF ;// CONFIG5L
  13. config CPB = OFF, CPD = OFF ;// CONFIG5H
  14. config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF ; // CONFIG6L
  15. config WRTB = OFF, WRTC = OFF, WRTD = OFF ; // CONFIG6H
  16. config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF ;// CONFIG7L
  17. config EBTRB = OFF
  18.  
  19. org 0x0000
  20. goto main
  21.  
  22. ;CONFIGURACION DE ENTRADA
  23. main
  24. movlw h'0F' ; Configuramos todos los pines como digitales
  25. movwf ADCON1
  26.  
  27. movlw b'11111111' ; configura los bits RA7-RA0 del puerto A
  28. movwf TRISA
  29.  
  30. clrf TRISB ;pongo todo en 0 el PUERTO B
  31.  
  32. clrf TRISC ;pongo todo en 0 en el PUERTO C
  33.  
  34. clrf TRISD ;pongo todo en 0 en el PUERTO D
  35.  
  36. goto inicio ;SALTO A LA ETIQUETA
  37.  
  38. conversorBinDec
  39. movff PORTA, entrada
  40. movf entrada, W
  41. btfsc STATUS, Z ; Z = 1 ? Consulta si es 0 (cero)
  42. call Cero ; 0
  43. movwf leido ; Mueve el valor de W a leido y comienza a decrementarlo
  44. decf leido ; hasta que llegue a 0 el que de cero es el valor a representar
  45. btfsc STATUS, Z
  46. call Uno ; 1
  47. decf leido
  48. btfsc STATUS, Z
  49. call Dos ; 2
  50. decf leido
  51. btfsc STATUS, Z
  52. call Tres ; 3
  53. decf leido
  54. btfsc STATUS, Z
  55. call Cuatro ; 4
  56. decf leido
  57. btfsc STATUS, Z
  58. call Cinco ; 5
  59. decf leido
  60. btfsc STATUS, Z
  61. call Seis ; 6
  62. decf leido
  63. btfsc STATUS, Z
  64. call Siete ; 7
  65. decf leido
  66. btfsc STATUS, Z
  67. call Ocho ; 8
  68. decf leido
  69. btfsc STATUS, Z
  70. call Nueve ; 9
  71. decf leido
  72. btfsc STATUS, Z
  73. call Diez
  74. decf leido
  75. btfsc STATUS, Z
  76. call Once
  77. decf leido
  78. btfsc STATUS, Z
  79. call Doce
  80. decf leido
  81. btfsc STATUS, Z
  82. call Trece
  83. decf leido
  84. btfsc STATUS, Z
  85. call Catorce
  86. decf leido
  87. btfsc STATUS, Z
  88. call Quince
  89. decf leido
  90. btfsc STATUS, Z
  91. call Dieciseis
  92. decf leido
  93. btfsc STATUS, Z
  94.  
  95. decf leido
  96. btfsc STATUS, Z
  97.  
  98. decf leido
  99. btfsc STATUS, Z
  100.  
  101. decf leido
  102. btfsc STATUS, Z
  103.  
  104. decf leido
  105. btfsc STATUS, Z
  106.  
  107. decf leido
  108. btfsc STATUS, Z
  109.  
  110. decf leido
  111. btfsc STATUS, Z
  112.  
  113. decf leido
  114. btfsc STATUS, Z
  115.  
  116. decf leido
  117. btfsc STATUS, Z
  118.  
  119. decf leido
  120. btfsc STATUS, Z
  121.  
  122. decf leido
  123. btfsc STATUS, Z
  124.  
  125. decf leido
  126. btfsc STATUS, Z
  127.  
  128. decf leido
  129. btfsc STATUS, Z
  130.  
  131. decf leido
  132. btfsc STATUS, Z
  133.  
  134. decf leido
  135. btfsc STATUS, Z
  136.  
  137. decf leido
  138. btfsc STATUS, Z
  139.  
  140. decf leido
  141. btfsc STATUS, Z
  142.  
  143. decf leido
  144. btfsc STATUS, Z
  145.  
  146. decf leido
  147. btfsc STATUS, Z
  148.  
  149. decf leido
  150. btfsc STATUS, Z
  151.  
  152. decf leido
  153. btfsc STATUS, Z
  154.  
  155. decf leido
  156. btfsc STATUS, Z
  157.  
  158. decf leido
  159. btfsc STATUS, Z
  160.  
  161. decf leido
  162. btfsc STATUS, Z
  163.  
  164. decf leido
  165. btfsc STATUS, Z
  166.  
  167. decf leido
  168.  
  169. ;PUENTES BITS
  170. ;bits ;SALTO A LA ETIQUETA
  171. ;movff PORTA,PORTB
  172.  
  173. return ;SALTO A LA ETIQUETA INICIO
  174. Cero
  175. movlw b'0111111'
  176. movwf PORTC
  177. movlw b'0111111'
  178. movwf PORTD
  179. movf entrada, W
  180. movwf PORTB
  181. return
  182. Uno
  183. movlw b'0111111'
  184. movwf PORTC
  185. movlw b'0000110'
  186. movwf PORTD
  187. movf entrada, W
  188. movwf PORTB
  189. return
  190. Dos
  191. movlw b'0111111'
  192. movwf PORTC
  193. movlw b'1011011'
  194. movwf PORTD
  195. movf entrada, W
  196. movwf PORTB
  197. return
  198. Tres
  199. movlw b'0111111'
  200. movwf PORTC
  201. movlw b'1001111'
  202. movwf PORTD
  203. movf entrada, W
  204. movwf PORTB
  205. return
  206. Cuatro
  207. movlw b'0111111'
  208. movwf PORTC
  209. movlw b'1100110'
  210. movwf PORTD
  211. movf entrada, W
  212. movwf PORTB
  213. return
  214. Cinco
  215. movlw b'0111111'
  216. movwf PORTC
  217. movlw b'1101101'
  218. movwf PORTD
  219. movf entrada, W
  220. movwf PORTB
  221. return
  222. Seis
  223. movlw b'0111111'
  224. movwf PORTC
  225. movlw b'1111101'
  226. movwf PORTD
  227. movf entrada, W
  228. movwf PORTB
  229. return
  230. Siete
  231. movlw b'0111111'
  232. movwf PORTC
  233. movlw b'0000111'
  234. movwf PORTD
  235. movf entrada, W
  236. movwf PORTB
  237. return
  238. Ocho
  239. movlw b'0111111'
  240. movwf PORTC
  241. movlw b'1111111'
  242. movwf PORTD
  243. movf entrada, W
  244. movwf PORTB
  245. return
  246. Nueve
  247. movlw b'0111111'
  248. movwf PORTC
  249. movlw b'1101111'
  250. movwf PORTD
  251. movf entrada, W
  252. movwf PORTB
  253. return
  254. Diez
  255. movlw b'0000110'
  256. movwf PORTC
  257. movlw b'0111111'
  258. movwf PORTD
  259. movf entrada, W
  260. movwf PORTB
  261. return
  262. Once
  263. movlw b'0000110'
  264. movwf PORTC
  265. movlw b'0000110'
  266. movwf PORTD
  267. movf entrada, W
  268. movwf PORTB
  269. return
  270. Doce
  271. movlw b'0000110'
  272. movwf PORTC
  273. movlw b'1011011'
  274. movwf PORTD
  275. movf entrada, W
  276. movwf PORTB
  277. return
  278. Trece
  279. movlw b'0000110'
  280. movwf PORTC
  281. movlw b'1001111'
  282. movwf PORTD
  283. movf entrada, W
  284. movwf PORTB
  285. return
  286. Catorce
  287. movlw b'0000110'
  288. movwf PORTC
  289. movlw b'1100110'
  290. movwf PORTD
  291. movf entrada, W
  292. movwf PORTB
  293. return
  294. Diez
  295. movlw b'0000110'
  296. movwf PORTC
  297. movlw b'0111111'
  298. movwf PORTD
  299. movf entrada, W
  300. movwf PORTB
  301. return
  302. Diez
  303. movlw b'0000110'
  304. movwf PORTC
  305. movlw b'0111111'
  306. movwf PORTD
  307. movf entrada, W
  308. movwf PORTB
  309. return
  310. Diez
  311. movlw b'0000110'
  312. movwf PORTC
  313. movlw b'0111111'
  314. movwf PORTD
  315. movf entrada, W
  316. movwf PORTB
  317. return
  318. Diez
  319. movlw b'0000110'
  320. movwf PORTC
  321. movlw b'0111111'
  322. movwf PORTD
  323. movf entrada, W
  324. movwf PORTB
  325. return
  326. Diez
  327. movlw b'0000110'
  328. movwf PORTC
  329. movlw b'0111111'
  330. movwf PORTD
  331. movf entrada, W
  332. movwf PORTB
  333. return
  334. Diez
  335. movlw b'0000110'
  336. movwf PORTC
  337. movlw b'0111111'
  338. movwf PORTD
  339. movf entrada, W
  340. movwf PORTB
  341. return
  342. Veinte
  343. movlw b'1011011'
  344. movwf PORTC
  345. movlw b'0111111'
  346. movwf PORTD
  347. movf entrada, W
  348. movwf PORTB
  349. return
  350. Veinte
  351. movlw b'1011011'
  352. movwf PORTC
  353. movlw b'0111111'
  354. movwf PORTD
  355. movf entrada, W
  356. movwf PORTB
  357. return
  358. Veinte
  359. movlw b'1011011'
  360. movwf PORTC
  361. movlw b'0111111'
  362. movwf PORTD
  363. movf entrada, W
  364. movwf PORTB
  365. return
  366. Veinte
  367. movlw b'1011011'
  368. movwf PORTC
  369. movlw b'0111111'
  370. movwf PORTD
  371. movf entrada, W
  372. movwf PORTB
  373. return
  374. Veinte
  375. movlw b'1011011'
  376. movwf PORTC
  377. movlw b'0111111'
  378. movwf PORTD
  379. movf entrada, W
  380. movwf PORTB
  381. return
  382. Veinticinco
  383. movlw b'1011011'
  384. movwf PORTC
  385. movlw b'0111111'
  386. movwf PORTD
  387. movf entrada, W
  388. movwf PORTB
  389. return
  390. Veintiseis
  391. movlw b'1011011'
  392. movwf PORTC
  393. movlw b'0111111'
  394. movwf PORTD
  395. movf entrada, W
  396. movwf PORTB
  397. return
  398. Veintisiete
  399. movlw b'1011011'
  400. movwf PORTC
  401. movlw b'0111111'
  402. movwf PORTD
  403. movf entrada, W
  404. movwf PORTB
  405. return
  406. Veintiocho
  407. movlw b'1011011'
  408. movwf PORTC
  409. movlw b'0111111'
  410. movwf PORTD
  411. movf entrada, W
  412. movwf PORTB
  413. return
  414. Veintinueve
  415. movlw b'1011011' ;;Decena
  416. movwf PORTC
  417. movlw b'0111111' ;;Unidad
  418. movwf PORTD
  419. movf entrada, W
  420. movwf PORTB
  421. return
  422. Treinta
  423. movlw b'1001111'
  424. movwf PORTC
  425. movlw b'0111111'
  426. movwf PORTD
  427. movf entrada, W
  428. movwf PORTB
  429. return
  430.  
  431. inicio
  432. call conversorBinDec
  433. ; movwf PORTC
  434. ; movwf PORTD
  435. goto inicio
  436.  
  437.  
  438. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement