locked
.Net microframework: Cannot make serialport public RRS feed

  • Question

  • Hello, I am new to embedded programming and I am working on a simple program on my usbizi devsys to read a serial port using the data received event. I first tried it by just printing "received" to the output window,that seemed to work but the event is only fired once. My second problem is that whenever I try to use the SerialPort in the "Data_received" method, it isn't recognized because the serial port is a local variable, and I didn't managed to make it public by just typing public fore the serialport. Can anyone please help me, I am stuck with this for a couple of days now.  Oh and I am using .netmf 4.0

    Here's my code:

    using

    using

    using

    using

    namespace

    {

    public class Program

    {

    public static void Main()

    {

    SerialPort UART = new SerialPort("COM1",9600);

    UART.Open();

    UART.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPort_DataReceived);

    }

    public static void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)

    {

    Debug.Print("Received !!");

     

    }

    }

    EventHandler_test
    System.Threading;
    Microsoft.SPOT;
    System.IO.Ports;
    System;
    • Moved by Harry Zhu Friday, May 14, 2010 5:39 AM I'm moving the therad relaing to microframework. (From:Visual C# General)
    Wednesday, May 12, 2010 6:30 AM

Answers

  • Hello,

    Try posting here: http://www.netmf.com/Discussion.aspx

    Those are the discussion forums for .net MF


    hth,
    Marcelo
    If my post solved you problem, please mark it as an "Answer". This way, other users that have the same questions will know how to proceed. If my post helped you some way, don't forget to score it as useful.
    Monday, May 17, 2010 2:12 PM