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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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. Contador1 equ 0x20 ;<br />

8. Contador2 equ 0x21 ;<br />

9.<br />

10. decre equ 0 ; Pulsador para decrem<strong>en</strong>tar Ciclo<br />

de Trabajo<br />

11. incre equ 1 ; Pulsador para increm<strong>en</strong>tar Ciclo<br />

de Trabajo<br />

12.<br />

13.<br />

14. ;/////////////////////////////////<br />

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

16. Reset.<br />

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

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

19.<br />

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

21. org 0x05<br />

22. Inicio<br />

23. bsf STATUS,RP0 ; Banco 1<br />

24. bsf TRISB,incre ; Como Entrada.-<br />

25. bsf TRISB,decre ; Como Entrada.-<br />

26. bcf TRISB,3 ; RB3 como Salida.<br />

27. bcf STATUS,RP0 ; Banco 0.-<br />

28. movlw b'00000110' ; Se selecciona TMR2, preescaler de 1/16.-<br />

29. movwf T2CON<br />

30. bsf STATUS,RP0 ; Banco 1<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!