CRTC Electronics

Click here to edit subtitle

Lesson 4

How to make a variable pause

Objective/Assignment


;Objective know how to:
; use the write register to fill variables

;Assignment:
;1 Write a program with 3 diferent "pauses" one of witch is a verable langeth pause
;2 Use comments!
;3 (***** Print and hand in this one *****)

Lesson

Add your main content here - text, photos, videos, addons, whatever you want!

Code

;*******************************************************************
;                           Name______________
;
;                            ___________
;        +      To positive     !Vdd   Vss!     To ground -
;                     Button    !A5        A0!     Input
;                              !A4        A1!        
;                            !A3        A2!        
;           Outside LED's    !C5        C0!  Buzzer            
;                    L4-1-8    !C4        C1!    
;                    L3-1-8    !C3        C2!        
;                    L2-1-8    !C6        B4!  LED        
;                    L1-1-8    !C7        B5!         
;            Button Light    !B7        B6!     Output
;                            -----------
;
;
;*******************************************************************

;Description:
;

#include <p16F690.inc>
    __config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)
    org 0 ; reset vector

    ;Reserve our Regesters
    cblock        H'20'    
        ;*******************
        ;Add veriables here:
            count1
            count2
            count3


        ;*******************
    endc
    
    ;Bank 3
    BSF     STATUS,RP1
    BCF     STATUS,RP0
    CLRF     ANSEL ;digital I/O
    CLRF     ANSELH ;digital I/O
    
    ;Bank 2
    BCF     STATUS,RP1
    BSF     STATUS,RP0

    movlw     B'00000000' ; 0=out 1=in
    movwf     TRISC ; **PORTC**    Set tristate mode

    movlw     B'11111111' ; 0=out 1=in
    movwf     TRISB ; **PORTB**    Set tristate mode

    movlw     B'11111111' ; 0=out 1=in
    movwf     TRISA ; **PORTA**   -Set tristate mode

    ;Bank 1
    BCF     STATUS,RP1
    BCF     STATUS,RP0

    ;Clear registers
    clrf     PORTA
    clrf     PORTB
    clrf     PORTC


    ;************************
    ;fill varialbes    
    clrf count1
    clrf count2
    clrf count3

    ;************************

    ;Clear w register
    movlw     b'00000000'
    


;Objective know how to:
; use the write register to fill variables

;Assignment:
;1 Write a program with 3 diferent "pauses" one of witch is a verable langeth pause
;2 Use comments!
;3 (***** Print and hand in this one *****)


;*****************************************
;***     MAIN    *************************
;*****************************************









;**********************************
;**            Subroutines            **
;**********************************












;**** HINTS *****
;
;    movlw B'11111111'    
;    
;
;pauseVar ;this function requiers you to asign count2 befor calling this pause
;
;    movwf count2
;    clrf count1
;
;    pauseVar_Loop
;        decfsz        count1,1     
;       goto        pauseVar_Loop        
;         decfsz        count2,1      
;          goto         pauseVar_Loop
;return
;
;




    
END

Members Area

Recent Blog Entries

Upcoming Events

Recent Videos

Recent Photos

Recent Forum Posts