Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 40
  1. #21

    Quote Originally Posted by stealthghost View Post
    ayaw kabalaka anang EEPROM. kay mao na'y sudlan sa imung data.

    Anyways, asa man jud ani imu wa nasabtan d.i bro? unsa nga line?

    Spoiler: Initialization sa PIC 

    Code:
    ; F_KEYPAD_84A_1.ASM WITH EEPROM
    ; TURN ON ALARM IF ACTIVATED BY PIR AND NO PWD INPUT (TIME-OUT)
    ;====================================================================
    ; P R O C E S S O R
    list     p=16F84A
    #include    <p16F84A.inc>
    
    __CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
    ;====================================================================
    ; M A C R O S (SEPARATE FILES)
    #include    <MOVLF.inc>
    #include    <MOVFF.inc>
    #include    <SUBLF.inc>
    #include    <SUBFF.inc>
    ;====================================================================
    ; P R E - L O A D  E E P R O M
    ORG     0X2100
    DE     01H, 02H, 03H, 04H     ; DEFINE EEPROM CONTENTS AT BURN TIME
    ;====================================================================
    ; R E S E T  V E C T O R
    ORG     0X000
    GOTO    SETTING
    ;====================================================================
    ; I N T E R R U P T  V E C T O R
    ORG     0X004
    RETFIE
    ;====================================================================
    ; M A I N
    SETTING
    BSF STATUS,RP0
    MOVLF 10H,PORTA
    BCF     PORTB,7
    BCF OPTION_REG,7
    BCF STATUS,RP0
    CLRF    PORTA
    
    ;--------------------------------------------------------------------


    Spoiler: Standby/Option Mode 

    Code:
    TRGR_MAIN
    CALL    LEDS_TRGR_MAIN
    BSF STATUS,RP0    
    MOVLF 77H,PORTB     ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    CALL    TST_MRK_BZR
    BCF     PORTB,3
    TST_TRGR_BZR
    BTFSS    1DH,0
    GOTO    TST_TRGR_RA4    ; ALARM OFF, TEST OTHER TRIGGERS
    GOTO    TRGR_PND_PWD    ; ALARM ON, PRESS # THEN PWD THEN *
    TST_TRGR_RA4
    BTFSS    PORTA,4
    GOTO    TST_TRGR_PND    ; ALARM OFF, NOT TRIGGERED BY PIR
    ; TRIGGERED BY RA4 (PIR)
    CALL    LEDS_IN_PWD     ; INPUT PWD (3 ATTEMPTS)
    MOVLF    3CH,29H     ; 3CH = 60 LOOPS BEFORE TIME-OUT
    BSF     1FH,7     ; MUST COUNT KEYPAD SCAN
    GOTO    INPUT_PWD    
    TST_TRGR_PND
    BTFSC    PORTB,6    
    GOTO    TST_TRGR_BZR    ; # NOT PRESSED, WAIT FOR TRIGGER
    GOTO    TRGR_PND_OPT    ; # PRESSED, WAIT FOR OPTION
    ;--------------------------------------------------------------------


    Spoiler: Entering Password 

    Code:
    INPUT_PWD
    MOVFF    12H,PORTA     ; LOAD CURRENT STATE OF INDICATORS
    INPUT_HERE
    CALL    ASK_PWD
    BTFSC    1FH,7
    GOTO    INPUT_CONT
    BSF     1DH,0     ; ALLOWED LOOPS FINISHED
    CALL    TST_MRK_BZR
    GOTO    TRGR_MAIN
    INPUT_CONT
    BTFSS    1DH,2
    GOTO    INPUT_HERE     ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    CALL    VERIFY_PWD     ; VERIFY PWD
    BTFSS    1DH,3     ; CORRECT PWD MARKER
    GOTO    INPUT_WRNG     ; WRONG PWD, TEST FOR 3RD ATTEMPT
    GOTO    TRGR_MAIN     ; CORRECT PWD, WAIT FOR INPUT
    ;--------------------------------------------------------------------
    INPUT_WRNG
    BTFSS    1DH,0
    GOTO    INPUT_PWD     ; ATTEMPTS<3, ASK FOR PWD
    GOTO    TRGR_MAIN     ; ATTEMPTS=3
    ;--------------------------------------------------------------------


    Spoiler: What will happen if you enter the passwrd 

    Code:
    TRGR_PND_PWD
    BTFSC    PORTB,6
    GOTO    TRGR_PND_PWD    ; # NOT YET PRESSED    
    TRGR_PND_PWD_IN     ; # PRESSED, INPUT PWD
    CALL    ASK_PWD
    BTFSS    1DH,2
    GOTO    TRGR_PND_PWD_IN    ; DID NOT REACH 4 INPUTS YET, WAIT FOR INPUT
    CALL    VERIFY_PWD     ; VERIFY PWD
    BTFSS    1DH,3     ; CORRECT PWD MARKER
    GOTO    TRGR_PND_WRNG    ; WRONG PWD
    ; CORRECT PWD, PRESS *
    BSF STATUS,RP0    
    MOVLF 77H,PORTB     ; ROW4 OF KEYPAD
    BCF STATUS,RP0
    BSF     PORTB,7     ; ALARM ON
    BCF     PORTB,3
    TRGR_PN_PW_AS
    BTFSC    PORTB,4     ; *
    GOTO    TRGR_PN_PW_AS    ; * NOT PRESSED
    BCF     PORTB,7     ; * PRESSED, DISABLE ALARM
    BCF     1DH,0
    CLRF    PORTA
    GOTO    TRGR_MAIN
    ;--------------------------------------------------------------------
    TRGR_PND_WRNG
    MOVLF    0FH,PORTA
    CALL    DELAY_FFX
    CLRF    PORTA
    GOTO    TRGR_MAIN
    ;--------------------------------------------------------------------


    Spoiler: Option Mode - to Arm the sensor, I guess, and change password 

    Code:
    TRGR_PND_OPT
    BSF     1DH,4     ; OPTION MODE MARKER
    CALL    LEDS_RA3N0
    BTFSC    PORTB,6
    GOTO    TRGR_PND_TST1    ; # NOT PRESSED
    GOTO    TRGR_PND_CNCL    ; # PRESSED, CANCEL OPTIONS
    TRGR_PND_TST1
    CALL    LEDS_RA3N0
    BTFSC    PORTB,4
    GOTO    TRGR_PND_TST2    ; * NOT PRESSED
    BSF     1DH,6     ; * PRESSED, SET ACTIVE PIR
    BCF     1DH,7
    ; TURN ON ALL PIRS
    GOTO    OPTION_PWD
    TRGR_PND_TST2
    CALL    LEDS_RA3N0
    BTFSC    PORTB,5
    GOTO    TRGR_PND_OPT    ; 0 NOT PRESSED, NO KEY PRESSED YET
    BCF     1DH,6     ; 0 PRESSED, CHANGE PWD
    BSF     1DH,7
    GOTO    OPTION_PWD
    TRGR_PND_CNCL
    CLRF    PORTA
    CALL    DELAY_FFX
    BCF     1DH,4
    GOTO    TRGR_MAIN
    ;--------------------------------------------------------------------


    Naa na man siya mga comments bro. dali ra man sabtun especially, nag naming siya sa mga functions.
    Kasabot ko gmay sa program pero naay tyms nga mg.libog ko f nganung ga.use ug BCF/ BTFSS/ ug BTFSC.. unsa may nakalahi nla
    sir stealthghost..??

  2. #22
    Quote Originally Posted by red_horse View Post
    Bitaw unsa may problem ana TS.
    Tsakto kaau ng gibuhat ni boss stealthghost. Bahinon ang program base sa function.
    Pero taas pa jud imo dapat tun-an ani TS.

    I used assembly kato first time jud nako gamit ug PIC.
    Gipa print nako ang datasheet labi na ang instruction set summary, pin diagrams, SFR's, whole UART and ADC section, example source codes sa net, etc, etc...
    I am not surprised ug di pa nimo masabtan ng codes na gihatag sa inyo teacher kay medyo complicated na siya.
    Dili lang estudyante ang tapulan karun, hasta na mga teacher. hehe.

    Ipa print ng gi post ni boss stealthghost then gam-i ug flowchart. Dili kayo lisud kay naa na mga comments.
    Then ug naa ka wa nasabtan, post lang dri. Good luck!
    btw sir red_horse.. ng.try nko ug make ug flowchart before ko ng.post ug thread dri.... medyo glisud jud ko ky libog man gud xa pwo ok2 npud gmay ky naay mga comments nga murag clue rgarding sa codes nga gpangbutang ni ma'am....

  3. #23
    Quote Originally Posted by outwit View Post
    Kasabot ko gmay sa program pero naay tyms nga mg.libog ko f nganung ga.use ug BCF/ BTFSS/ ug BTFSC.. unsa may nakalahi nla
    sir stealthghost..??
    BCF Bit Clear f
    Let's put that in C language

    Assembly
    BCF PORTB, 7

    In C Language,
    RB7 (or PORTB.7) = 0

    PORTB has 0-7 nga pins, RB1... RB7...
    RB7 was just cleared or equal to zero.

    ==============

    BTFSS, Bit Test f, Skip if Set
    This is a loop function. FOR or DO-WHILE LOOP.

    Assembly
    INPUT_CONT
    BTFSS 1DH,2 ; Checks if Memory 1DH of 2nd bit is SET means not equal to zero
    GOTO INPUT_HERE ; IF WALA PA GANI, at it says, BIT TEST F, SKIP IF SET, SINCE WALA PA NA SET, balik siya sa INPUT_HERE
    CALL VERIFY_PWD ; IF na-set na gani, means not equal to zero na ang 1DH 2nd bit, skip niya ang babaw nga line, tawag na xa sa verify_pwd

    (Correct me if I'm wrong bai red_horse, banga na kaayu ko sa assembly ani.. hehehe)

    in C Language

    do{
    GOT to INPUT_PASSWORD
    }while(1dh.2ndbit == 1) //not actual variables
    // if done with input password, go to verify
    GO TO VERIFY_PWD


    ANG BTFSC, baliktad ra sa BTFSS, instead of 1, check niya if CLEARED na or equal to zero.

    EDIT: Just download any Datasheet, naa na dapit sa tumoy ang kanang mga BTFSS, BTFSC, BCF, BSF, etc. ang description ana.
    Last edited by stealthghost; 03-22-2013 at 01:54 AM.

  4. #24
    Quote Originally Posted by outwit View Post
    Kasabot ko gmay sa program pero naay tyms nga mg.libog ko f nganung ga.use ug BCF/ BTFSS/ ug BTFSC.. unsa may nakalahi nla
    sir stealthghost..??
    Add lang ko hah...
    Pag proteus nalang TS. Mas dali nimo masabtan pag makita nimo sa simulation.
    You can start turning ON/OFF an LED using BSF and BCF.
    You can then add a button to your circuit to detect button press and use BTFSS and BTFSC sa imo codes.
    You can then add a delay and de-bouncing routines.
    Dapat anaon unta mo pagtudlo sa inyo teacher.

    As you can see ang difference ra sa instructions na imo gilibgan kay clear or set ra.
    It is just another word for 0 and 1, or OFF and ON, respectively.

  5. #25
    Quote Originally Posted by stealthghost View Post
    BCF Bit Clear f
    Let's put that in C language

    Assembly
    BCF PORTB, 7

    In C Language,
    RB7 (or PORTB.7) = 0

    PORTB has 0-7 nga pins, RB1... RB7...
    RB7 was just cleared or equal to zero.

    ==============

    BTFSS, Bit Test f, Skip if Set
    This is a loop function. FOR or DO-WHILE LOOP.

    Assembly
    INPUT_CONT
    BTFSS 1DH,2 ; Checks if Memory 1DH of 2nd bit is SET means not equal to zero
    GOTO INPUT_HERE ; IF WALA PA GANI, at it says, BIT TEST F, SKIP IF SET, SINCE WALA PA NA SET, balik siya sa INPUT_HERE
    CALL VERIFY_PWD ; IF na-set na gani, means not equal to zero na ang 1DH 2nd bit, skip niya ang babaw nga line, tawag na xa sa verify_pwd

    (Correct me if I'm wrong bai red_horse, banga na kaayu ko sa assembly ani.. hehehe)

    in C Language

    do{
    GOT to INPUT_PASSWORD
    }while(1dh.2ndbit == 1) //not actual variables
    // if done with input password, go to verify
    GO TO VERIFY_PWD


    ANG BTFSC, baliktad ra sa BTFSS, instead of 1, check niya if CLEARED na or equal to zero.

    EDIT: Just download any Datasheet, naa na dapit sa tumoy ang kanang mga BTFSS, BTFSC, BCF, BSF, etc. ang description ana.
    hhmm... cge2 sir stealthghost, ako tan.awn blik ang codes sa program.. medyo libog pa jd gmay...

  6. #26
    Quote Originally Posted by red_horse View Post
    Add lang ko hah...
    Pag proteus nalang TS. Mas dali nimo masabtan pag makita nimo sa simulation.
    You can start turning ON/OFF an LED using BSF and BCF.
    You can then add a button to your circuit to detect button press and use BTFSS and BTFSC sa imo codes.
    You can then add a delay and de-bouncing routines.
    Dapat anaon unta mo pagtudlo sa inyo teacher.

    As you can see ang difference ra sa instructions na imo gilibgan kay clear or set ra.
    It is just another word for 0 and 1, or OFF and ON, respectively.
    cge, mg.try lng kug pama-agi nga mka.gmit kug proteus..
    dba sir redhorse if set dba ky equals to 1 jud na or depende??
    if clear, zero jud na xa dba sir redhorse??

  7. #27
    Quote Originally Posted by cebugdev View Post
    unsa may purpose na gihatag sa inyo teacher ang code? para tun.an?
    nya ngano man dli nnyu tun.an, busy'g DOTA?
    basin gi hatag ni sa studyante kay ang maestra di kamao mo code bah, hahahaha!!!

    aron naa siyay code para sa iyang sideline!!! weeeeeeeeeeeeee!!!

  8. #28
    Quote Originally Posted by outwit View Post
    cge, mg.try lng kug pama-agi nga mka.gmit kug proteus..
    dba sir redhorse if set dba ky equals to 1 jud na or depende??
    if clear, zero jud na xa dba sir redhorse??
    Tama!
    set = 1 = 5v
    clear = 0 = 0v
    if you like tagaan tika mga example source codes sa assembly using mplab.

    Quote Originally Posted by emailroy2002 View Post
    basin gi hatag ni sa studyante kay ang maestra di kamao mo code bah, hahahaha!!!

    aron naa siyay code para sa iyang sideline!!! weeeeeeeeeeeeee!!!

    Correct!!! Or gamiton para sa masteral. hahahah
    Last edited by red_horse; 03-24-2013 at 06:17 AM. Reason: Wrong quotations...

  9. #29
    @outwit, tuo aning red_horse.. bangiitan ni nga maestro sa Microchip.. ^_^

  10. #30

  11.    Advertisement

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

 
  1. Replies: 0
    Last Post: 03-19-2013, 09:54 PM
  2. need your help all istorya bros and sis
    By bingkat in forum Business, Finance & Economics Discussions
    Replies: 35
    Last Post: 03-19-2011, 06:21 AM
  3. need your help regarding zipping of files using php
    By Saedecode in forum Programming
    Replies: 2
    Last Post: 01-22-2011, 07:09 PM
  4. Replies: 3
    Last Post: 10-03-2010, 03:36 PM
  5. hey guys i really need your HELP...PLEASE its urgent
    By Mr. Fernandez in forum Computer Hardware
    Replies: 31
    Last Post: 11-15-2006, 05:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top