Dear, Paul
Thanks a lot for help:) Just one question: Is it possible to work with EM4095 RFID Reader on
ATmega128 either? I worked with EM4095 RFID Reader on ATmega644P (on evolution board)
using interrupts, configured "on change". Like a code below
[code:1:eb57b182f3]
$regfile = "m644pdef.dat"
$baud = 9600
$crystal = 16000000
Config Lcdpin = Pin , Rs = Portc.2 , E = Portc.3 , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Cls
Cursor Off Noblink
Dim Tags(5) As Byte , J As Byte
Config Hitag = 64 , Type = Em4095 , Demod = Pind.2 , Int = @int0
Rfid_mod Alias Portd.4
Rfid_mod_pin Alias Pind.4
Rfid_shd Alias Portd.3
Rfid_shd_pin Alias Pind.3
Config Rfid_mod_pin = Output
Config Rfid_shd_pin = Output
Reset Rfid_mod
Reset Rfid_shd
Waitms 100
Set Rfid_shd
Waitms 100
Reset Rfid_shd
On Int0 Checkints Nosave
Config Int0 = Change
Enable Interrupts
Do
If Readhitag(tags(1)) = 1 Then
Locate 1 , 1
For J = 1 To 5 Step 1
Lcd " " ; Hex(tags(j))
Next J
End If
Loop
End
Checkints:
Call _checkhitag
Return
[/code:1:eb57b182f3]
I tried to combine something for M128, but with no result. I Googled whole night long and I found this for m128:
[code:1:eb57b182f3]
$regfile = "m128def.dat"
$crystal = 16000000
Dim A As Byte , B1(10) As Byte , B2(10) As String * 1 , C As Byte , T As Bit
Dim Rfid As String * 10
Config Graphlcd = 240 * 128 , Dataport = Portb , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6
Cursor Off
Cls
C = 1
Locate 1 , 1
Lcd " 125Khz RFID-Reader"
Locate 2 , 1
Lcd " Unique, HT4102" ' <-- EN4102 is a transponder
Do
A = Inkey()
If A > 32 Then
B1(c) = A
B2(c) = Chr(b1(c))
If C = 10 Then
Rfid = B2(1) + B2(2) + B2(3) + B2(4) + B2(5) + B2(6) + B2(7) + B2(8) + B2(9) + B2(10)
Locate 4 , 1
Lcd Rfid
Locate 6 , 1
Lcd B1(1) ; B1(2) ; B1(3) ; B1(4) ; B1(5) ; B1(6) ; B1(7) ; B1(8) ; B1(9) ; B1(10)
C = 0
End If
Incr C
End If
Loop
End
[/code:1:eb57b182f3]
So, the question (maybe a newbie): Can I work with EM4095 RFID via interrupts or UART on
ATmega128? :smt024
Many thanks, Peter
↧