13.11.2012 Views

Mis primeros programas en assembler - Micros Designs

Mis primeros programas en assembler - Micros Designs

Mis primeros programas en assembler - Micros Designs

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Código<br />

GeSHi (asm):<br />

1. ; **** Encabezado ****<br />

2. list p=16f628A ; list directive to define processor<br />

3. #include ; processor specific variable definitions<br />

4. __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON &<br />

_INTOSC_OSC_NOCLKOUT & _DATA_CP_OFF & _LVP_OFF & _MCLRE_ON<br />

5.<br />

6. ;**** Definicion de variables ****<br />

7. DATA_RS232 equ 0x20 ; Dato recibido desde PC.-<br />

8. Flags equ 0x21 ;<br />

9. ;**** Definiciones para el <strong>en</strong>samblador ****<br />

10. #DEFINE Kbhit Flags,0 ; Indica si se ha recibido algun<br />

dato.-<br />

11. ;**** Definición de macros ****<br />

12. ; Se <strong>en</strong>via la data de un registro a PC.-<br />

13. Putreg macro Registro<br />

14. movfw Registro<br />

15. call RS232_EnviaDato<br />

16. <strong>en</strong>dm<br />

17. ; Se <strong>en</strong>via un literal a PC.-<br />

18. Putc macro ACKII<br />

19. movlw ACKII<br />

20. call RS232_EnviaDato<br />

21. <strong>en</strong>dm<br />

22.<br />

23.<br />

24. ;/////////////////////////////////<br />

25. ;**** Inicio del Micro ****<br />

26. Reset.<br />

27. org 0x00 ; Aquí comi<strong>en</strong>za el micro.-<br />

28. goto Inicio ; Salto a inicio de mi programa.-<br />

29.<br />

30. ;**** Vector de Interrupcion ****<br />

31. org 0x04 ; Ati<strong>en</strong>do Interrupcion.-<br />

32. goto ISR<br />

33.<br />

34. ; **** Programa Principal ****<br />

35. org 0x05<br />

Autor: Suky Mail: inf.pic.suky@live.com.ar Web: www.micros-designs.com.ar

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!