Netduino home hardware projects downloads community

Jump to content


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

Ckiszka

Member Since 25 Feb 2011
Offline Last Active Mar 04 2011 05:04 AM
-----

Posts I've Made

In Topic: Parallax RFID Reader

03 March 2011 - 08:45 PM

Chris...do you ever sleep? You have responded to me at all hours before. Thanks! I have found the error. The second example above is trying to define the “outPin” as an Output Port whereas like you said, the serial ports already claim D0 & D1. If I remove the instantiation of the Output Port (outPin…) and physically put the outPin lead into D0, it works perfect! P.S. I added an Output Port, the “enablePin” to the constructor. I am using this to disable/enable instead. Thanks again for pointing me in the right direction.

In Topic: Parallax RFID Reader

03 March 2011 - 07:43 PM

That will cause a problem. :)

You are using D0 as the "outPin" and also trying to use COM1 (which requires exclusive use of pins D0 and D1). So when the program tries to open up the serial port it can't...because D0 is already taken by "outPin".

Try changing your outPin to another pin (D2 through D13 are good).

Chris


Thanks! That fixed the error on the Port.Open.

Now I am not getting a "SerialPort_DataReceived" event. How does the program read data in from the RFID if the pinOut does not go to D0 or D1 and it is never assign an event handler or function in code?

In Topic: Parallax RFID Reader

03 March 2011 - 07:11 PM

Hi Ckiszka,

Can you zip up your project and attach it to this thread?

Also, what serial port are you using? Make sure that you create your serial port object before trying to use it. Otherwise you might be trying to open an "empty" serial port.

Also, be sure that you're not using the pins from that serial port for something else...

Chris


I appreciate your help!

I assume pin D0 is the defacto COM1 port? In code, when setting up the SerialPort, I do not see a specified pin assignment. I am using D0.

Project Code

In Topic: Parallax RFID Reader

03 March 2011 - 05:48 PM

Also, make sure that you put your "Read" code in a loop if you need to wait for all 12 bytes.

For instance:

int count = 0;
while (count < 12)
{
    try 
    { 
        count += SerialPort.Read(buf, count, 12 - count);
    } 
    catch (Exception ex) 
    { 
        // if we get a timeout, go ahead and break free from the while loop.
        break;
    }
}


I am not even getting that far. I am using example two

 public void EnableReader()
        {
            if (!SerialPort.IsOpen) SerialPort.Open(); //Bombs Here
            RFIDOut.Write(false);
            ReaderEnabled = true;
        }


#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::ReservePin [IP: 0000] ####
#### System.IO.Ports.SerialPort::HandlePinReservations [IP: 003a] ####
#### System.IO.Ports.SerialPort::Open [IP: 001d] ####
#### BottleStats.ParalaxRFID::EnableReader [IP: 0013] ####
#### BottleStats.ParalaxRFID::.ctor [IP: 0067] ####
#### BottleStats.ParalaxRFID::.ctor [IP: 0016] ####
#### BottleStats.Program::InitializeSensors [IP: 0024] ####
#### BottleStats.Program::Main [IP: 0004] ####
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.SPOT.Hardware.dll
#### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (1) ####
#### Message:
#### System.IO.Ports.SerialPort::HandlePinReservations [IP: 0093] ####
#### System.IO.Ports.SerialPort::Open [IP: 001d] ####
#### BottleStats.ParalaxRFID::EnableReader [IP: 0013] ####
#### BottleStats.ParalaxRFID::.ctor [IP: 0067] ####
#### BottleStats.ParalaxRFID::.ctor [IP: 0016] ####
#### BottleStats.Program::InitializeSensors [IP: 0024] ####
#### BottleStats.Program::Main [IP: 0004] ####

In Topic: Parallax RFID Reader

03 March 2011 - 08:56 AM

I added the try/catch, it catches every other second.

I bookmarked this page sometime ago and ordered the Parallax RFID reader. I have two programs using both the examples above. I cannot get any of them to work. I am not sure what I am doing wrong.

Here is my setup:

Posted Image

Posted Image


Here is the First Example, error:

Posted Image

Second example, error:

Posted Image

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.