Jump to content
ELFORUM - Forumul electronistilor

proiect ce foloseste Atmega8


Guest luncaboy

Recommended Posts

Guest luncaboy

Salut!Am si io de facut un proiect numit "Controlul accesului intr-o parcare utilizand o bariera".Ptr asta am la dispozitire o placa EEDT 5.0 cu 2 microcontrolere:A89S52 si ATmega8,un Rfid Card Reader ptr partea de autentificare ,un servomotor Futaba S3003 si senzori de miscare.Problema e ca sunt newb in acest domeniu si as avea nevoie de ajutor,in primul rand cu realizarea conexiunilor si apoi cu partea de cod.Merci anticipat!

Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • em2006

    2

Pai fa ce zice-n manual. Incepe cu asta:[attachment=0]start eedt.pdf[/attachment]Unde nu intelegi, intreaba pe forum, sunt destui care te pot ajuta.

Link to comment
  • 3 weeks later...
Guest luncaboy

Am conectat RFID la 89s52 si am scris un cod care trebuie sa faca uC sa primeasca un cod de identificare de la RFID,sa-l compare cu un cod pastrat in memorie si daca sunt egale sa aprinda un led de pe placa.Am testat codul dar din nefericire nu functioneaza.Daca este cineva care se pricepe la assembler il rog sa ma ajute sa fac codul functionabil. Mentionez ca readerul trimite un cod de 12 bytes din care primul este 0x0A,ultimul este 0x0D iar cei 10 bytes de la mijloc reprezinta codul de identificare propriu-zis.Merci anticipat.

COUNTER:DS 1RECEIVED BIT 00h              ;this is the bit that confirms the receival of 10 bytesVALID_TAG BIT 01h             ;this is the bit that confirms the receival of a valid tagBYTE: DS 10                   ;in this variable i will store the values of the incoming bytesBYTES: DB 30h,34h,31h,35h,44h,38h,41h,31h,46h,31h   ;Is this correct???                                                     ;this is a valid tag IDAJMP START        START:  MOV TMOD,#20h        MOV SCON,#50h        MOV TH1,#0F4h        MOV TL1,#0F4h        SETB TR1        MOV COUNTER,#01h    ;init counter        CLR RECEIVED        CLR VALID_TAG        SETB P2.0                ;the LED must be in off stateFIRST_BYTE:     JB TI,TRANS      ;if transmission is over jump to trans                MOV A,SBUF                CJNE A,#0Ah,LAST_BYTE   ;check first byte                MOV COUNTER,#01h                AJMP RECEVLAST_BYTE:      CJNE A,#0Dh,SEC_BYTE     ;check 12-th byte                 MOV COUNTER,#01h                AJMP RECEVSEC_BYTE:       MOV R1,COUNTER            ;second byte                CJNE R1,#01h,TRD_BYTE                MOV BYTE,A                AJMP INCTRD_BYTE:       CJNE R1,#02h,FRTH_BYTE    ;third byte                MOV BYTE+1,A                AJMP INCFRTH_BYTE:      CJNE R1,#03h,FIFTH_BYTE   ;fourth byte                    MOV BYTE+2,A                AJMP INCFIFTH_BYTE:     CJNE R1,#04h,SIXTH_BYTE     ;fifth byte                MOV BYTE+3,A                AJMP INCSIXTH_BYTE:       CJNE R1,#05h,SEVENTH_BYTE  ;sixth byte                MOV BYTE+4,A                AJMP INCSEVENTH_BYTE:       CJNE R1,#06h,EIGHT_BYTE   ;seventh byte                MOV BYTE+5,A                AJMP INCEIGHT_BYTE:       CJNE R1,#07h,NINTH_BYTE     ;eight byte                  MOV BYTE+6,A                AJMP INCNINTH_BYTE:       CJNE R1,#08h,TENTH_BYTE     ;ninth byte                MOV BYTE+7,A                AJMP INCTENTH_BYTE:       CJNE R1,#09h,ELEVENTH_BYTE  ;tenth byte                MOV BYTE+8,A                AJMP INCELEVENTH_BYTE:       CJNE R1,#0Ah,INC         ;eleventh                MOV BYTE+9,A                SETB RECEIVED                AJMP INC       INC:    INC COUNTERRECEV:  CLR RI        RETTRANS:  CLR TI        RETCHECK:  JB RECEIVED,COMPARE         ;if we received a 10 bytes tag ID jump to compare        RETCOMPARE:        MOV A,BYTES       ;compare the content of what we received with what we have in memory                CJNE A,BYTE,FGG    ;the comparisson is done at a byte-by-byte level                MOV A,BYTES+1                CJNE A,BYTE+1,FGG                MOV A,BYTES+2                CJNE A,BYTE+2,FGG                MOV A,BYTES+3                CJNE A,BYTE+3,FGG                MOV A,BYTES+4                CJNE A,BYTE+4,FGG                MOV A,BYTES+5                CJNE A,BYTE+5,FGG                MOV A,BYTES+6                CJNE A,BYTE+6,FGG                MOV A,BYTES+7                CJNE A,BYTE+7,FGG                MOV A,BYTES+8                CJNE A,BYTE+8,FGG                MOV A,BYTES+9                CJNE A,BYTE+9,FGG                SETB VALID_TAGFGG:    RETLED_CHECK:      JB VALID_TAG,GLOW_LED   ;if tag ID is a valid tag then make a LED glow                RETGLOW_LED:       CLR P2.0                SJMP GLOW_LEDEND
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines