- Netduino Forums
- → Thomas's Content
Thomas's Content
There have been 15 items by Thomas (Search limited from 22-May 23)
#10705 Exploring the Netduino
Posted by Thomas on 09 March 2011 - 07:53 AM in General Discussion
#10703 "No results found for 'labview'."?
Posted by Thomas on 09 March 2011 - 07:39 AM in General Discussion
#9578 2x16 LCD Menu Class ?
Posted by Thomas on 15 February 2011 - 01:31 PM in General Discussion
#7740 Replace analog pot with Netduino using PWM
Posted by Thomas on 16 January 2011 - 01:04 AM in Netduino 2 (and Netduino 1)
#7487 MagStripe Reader with Netduino
Posted by Thomas on 12 January 2011 - 01:35 AM in General Discussion
#7333 Notifications from Netduino
Posted by Thomas on 09 January 2011 - 12:28 PM in General Discussion
- Cooking Hacks: GPRS QUADBAND MODULE FOR ARDUINO
- Sparkfun: Cellular Shield with SM5100B
I got the Cooking Hacks one, but up until now, only tried it with an Arduino, but I'm planning on giving it a go with the Netduino too. If I remember correctly, some custom wiring is necessary since it uses the ICSP connector on the Arduino, but nothing complicated, just power (the regular power pins are not used since the gsm module is placed in that spot).
/Thomas
#7329 MagStripe Reader with Netduino
Posted by Thomas on 09 January 2011 - 12:07 PM in General Discussion
Yes, that's right. If you want to get the state of other pins, you may check out sweetlilmre's post - he has built a custom firmware with extended InterruptPort, which passes an array of [watched] pin states to the interrupt handler.
That looks very interesting!
Do you know if that firmware is available to test? I don't have access to the Keil Compiler so a binary FW would be what I needed.
Thanks,
/Thomas
#7299 MagStripe Reader with Netduino
Posted by Thomas on 09 January 2011 - 12:12 AM in General Discussion
In addition to what Chris said, you can also use the second parameter of the interrupt handler (udata2), it contains the pin state at the time the interrupt has occurred, contrary to pin.Read() method call that retrieves the pin state while the interrupt handler routine is being executed.
Cool, thanks!
I guess that udata2 only holds the state of the pin triggering the interrupt, and not the other pins, but even then, this is what I need when constructing the two arrays.
/Thomas
#7295 MagStripe Reader with Netduino
Posted by Thomas on 08 January 2011 - 11:13 PM in General Discussion
#7279 MagStripe Reader with Netduino
Posted by Thomas on 08 January 2011 - 04:50 PM in General Discussion
I have been playing around with a Mag Stripe reader (the one I use only reads track 2), but at the moment it only works when I swipe the card very slowly through the reader.
The outputs from the reader is:
- Card Present
- Clock
- Data
When a card is swiped, the Card Present will first go low, and the clock wil start switching high and low, and when the clock goes from high to low, you are suppose to sample the data line, which becomes stable a short while before and keeps stable as long as the clock is low.
The clock is not constant, but depends on how fast you swipe the card. Swiping the card slowly results in something like 500 Hz, going about normal speed you will get a clock speed of roughly 1 to 1.5 kHz and swiping it fast will probably be 2-4 kHz.
I wrote some code (included below) which seemd to work when swiping the card slowly, but when the speeds get to what most people would do, it won't read the values correctly.
Am I using the InterruptPort correctly?
How long does the InputPort.Read() method take to read the pin state?
In the code below, I just put a breakpoint at the end of cp_OnInterrupt and look at the temp variable to see what was read.
using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace MagStripeReader { public class Program { public static byte[] data = new byte[1024]; public static int count = 0; public static InputPort dataPin = new InputPort(Pins.GPIO_PIN_D6, false, Port.ResistorMode.PullUp); public static void Main() { // write your code here InterruptPort clk = new InterruptPort(Pins.GPIO_PIN_D10, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); clk.OnInterrupt += new NativeEventHandler(clk_OnInterrupt); InterruptPort cp = new InterruptPort(Pins.GPIO_PIN_D5, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh); cp.OnInterrupt += new NativeEventHandler(cp_OnInterrupt); Thread.Sleep(Timeout.Infinite); } static void cp_OnInterrupt(uint data1, uint data2, DateTime time) { bool inStartZone = true; bool inEndZone = false; byte[] temp = new byte[1024]; int charCounter = 0; int bitCounter = 0; for (int i = 0; i < count; i++) { if (inStartZone && data[i] == 1) { } else if (inStartZone == false) { bitCounter = 0; if (data[i+0] == 0) { temp[charCounter] |= (byte)(1 << bitCounter); } bitCounter++; if (data[i + 1] == 0) { temp[charCounter] |= (byte)(1 << bitCounter); } bitCounter++; if (data[i + 2] == 0) { temp[charCounter] |= (byte)(1 << bitCounter); } bitCounter++; if (data[i + 3] == 0) { temp[charCounter] |= (byte)(1 << bitCounter); } bitCounter++; charCounter++; i += 4; } else { i--; inStartZone = false; } } count = 0; return; } static void clk_OnInterrupt(uint data1, uint data2, DateTime time) { data[count] = 0; if (dataPin.Read()) { data[count] = 1; } count++; } } }
#6942 RFID Reader Opinions
Posted by Thomas on 04 January 2011 - 12:03 AM in General Discussion
#6857 RFID Reader Opinions
Posted by Thomas on 02 January 2011 - 10:02 PM in General Discussion
#6664 RFID Reader Opinions
Posted by Thomas on 29 December 2010 - 07:58 PM in General Discussion
#6617 Iphone interface to Netduino via audio jack
Posted by Thomas on 28 December 2010 - 11:56 PM in Visual Studio
#160 Reversing the pushbutton state -- feedback?
Posted by Thomas on 09 August 2010 - 05:03 PM in Netduino 2 (and Netduino 1)
- Netduino Forums
- → Thomas's Content
- Privacy Policy