Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.


Member Since 04 Jul 2012
Offline Last Active Oct 23 2014 11:04 AM

Posts I've Made

In Topic: Send Bytes over I2C.

03 October 2012 - 02:06 PM

Thanks but this doesn't get me any further. Does the '80' only apply to the address or also to the command byte?

This gives an error:
outbytes = New Byte() {80, 1, 1}
                IIC.WriteRead(outbytes, inbytes)
And this too:
outbytes = New Byte() {161, 1, 1}
                IIC.WriteRead(outbytes, inbytes)

If I split up the reading from the writing, I get beyond this just fine:
outbytes = New Byte() {80, 1, 1}

But then the exception is thrown right after when I try to read into 'inbytes':
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
Exception was thrown: System.ArgumentException

So it seems it goes bad when reading.

My problem is A) being new to Netduino and embedded in general, B ) never used I²C and C) not familiar with this particular device (RFID reader).
This means a lot of unknowns in the equation, and I don't know how to code up I²C straight from the µF in VB. Is my VB code bad or do I just send or expect the wrong things from the slave device?

For point B I try to use the Toolbox I2C-helper but I'm doing something wrong obviously.
For point C here's the device (+datasheet): http://www.stronglin...ules/sl030.html

I found some assembler-ish or C-like code samples to interface this device over I²C and hoped to understand it and 'translate' it to my needs but I must admit I don't really get what I'm seeing.

I'm hoping someone out here could show me the way or guide me through the learning process? I'd really appreciate that.
- Franki

EDIT: opened a new topic for this HERE since I think I made a breakthrough.

In Topic: Send Bytes over I2C.

03 October 2012 - 07:20 AM

As a coincidence, I was trying about the same thing last night - and failed!
I'm trying to read the card ID from an RFID reader through I²C.

Here's my code:
Dim IIC As New MultiI2C(161, 100)
    Dim outbytes() As Byte = New Byte() {}
    Dim inbytes() As Byte = New Byte() {}
    outbytes = New Byte() {161, 1, 1}
    IIC.WriteRead(outbytes, inbytes)

I made an event handler based on the 'card detected' output, fed to an input. This works fine.
The last 2 lines of code are in the interrupt / event handler because it only makes sense to talk to the reader when a card is detected.

And here's where it crashes:
"A first chance exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
Exception was thrown: System.ArgumentException"

Why 161: the datasheet says I need a 7 bit address (default = 80), and the 8th bit (LSB) should be '1' to read.
That gives: 10100001 = 161.

Why {161, 1, 1}: the specs say:
  • Address: 1 byte, 0xA0
  • Len: Byte length counting from Command Code to the last byte of the data, 1 byte.
  • Command: Command Code, 1 byte.
  • Data: Data, variable length depends on the command type.
So read from address 80 = 161, 1 byte length, command = 1

The question is: do I use the VB code in a wrong way, or don't I understand the specs of the I²C protocol?
I can't find any useful information online that combines N+ with VB and I²C. So I need to turn to this forum once again for help...

HELP! :wacko:
- Franki

In Topic: Using Adafruit RGB LCD Shield (I²C)

03 October 2012 - 06:56 AM

I finally got to test it and yes it sure works! :D Thanks!

In Topic: Problem using AnalogInput

20 September 2012 - 08:30 PM


I just installed 'Version: 4.2.0 Update 1 (version' of the firmware, I was still running 'NetduinoPlus_4.2.0.0_RC5' which I believed to be the most recent but it turned out Chris W published an update note yesterday. My bad! :huh:

My led is now blinking to the value of the potmeter. Finally!

Is there an online document or resource where I can get an overview of the most used classes for I/O (RS-232, I2C, SPI, PWM etc)? I'd love to learn more without having to ask too many questions, like I try to solve my Win Forms programming problems.

Thanks again for all your help!
- Franki

In Topic: Problem using AnalogInput

20 September 2012 - 06:05 PM

Dear Kem, I really appreciate your time and effort, but all your hints don't work for me (so far).
I opened a totally new solution from scratch. Even one single line of code causes the program to break:

Imports Microsoft.SPOT
Imports Microsoft.SPOT.Hardware
Imports SecretLabs.NETMF.Hardware
Imports SecretLabs.NETMF.Hardware.NetduinoPlus

Module Module1
    Sub Main()
        ' write your code here
        Dim potMeter As New AnalogInput(AnalogChannels.ANALOG_PIN_A1)
    End Sub
End Module

An attached PNG shows my references.
I just don't get it, it's always 'An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll'and the execution breaks.

I wrote a button-lights-led program that works so it's really the AnalogInput part that bothers me.

- Franki

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.