.Net MicroFramework compatibility ?

Supporting Visual Studio on Windows
becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

.Net MicroFramework compatibility ?

Postby becafuel » Fri May 21, 2010 3:02 am

Hello,

it seems that the (current) Phidget assembly is not compatible with this framework.

Is this lots of work to make it compatible ? Or is there any plan to support this framework in the near future ?



Best regards,
_________
Christophe

User avatar
Patrick
Lead Developer
Posts: 3089
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: .Net MicroFramework compatibility ?

Postby Patrick » Fri May 21, 2010 8:40 am

This is not currently in the plans.

-Patrick

becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

Re: .Net MicroFramework compatibility ?

Postby becafuel » Fri May 21, 2010 8:52 am

Too bad :cry:

Do you know if there's another way of interacting with Phidgets from a .Net program ?
I mean without using standard assembly ? Something like dll calls.

My goal was to make an autonomous board like FEZ Domino control the Phidgets USB boards (motor controllers and encorder, for instance).
I know I won't have much problems with analog sensors, but it would have been nice to also have control over USB boards, as they are "only" HID devices.

Or... do you have any document/specification of the USB properties for such boards ?

User avatar
Patrick
Lead Developer
Posts: 3089
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: .Net MicroFramework compatibility ?

Postby Patrick » Fri May 21, 2010 11:56 am

The .NET library just calls directly into the C library - the C library is where all the real code is, the .NET library is really just a wrapper around the C library.
ie:

Code: Select all

        [DllImport("phidget21.dll")]
        public static extern Int32 CPhidget_open(IntPtr phidA, Int32 serialNumber);

-Patrick

becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

Re: .Net MicroFramework compatibility ?

Postby becafuel » Fri May 21, 2010 12:32 pm

That's fine ! Thank you very much !

Is the source of the wrapper freely available or not ? Or, if not, could you just tell me some types I will have to use, please ?

becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

Re: .Net MicroFramework compatibility ?

Postby becafuel » Sat May 22, 2010 10:33 am

Forget it. It won't work.

Thank you for your reply, anyway.

User avatar
Patrick
Lead Developer
Posts: 3089
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: .Net MicroFramework compatibility ?

Postby Patrick » Tue May 25, 2010 8:29 am

I'd be interested in why it won't work?

-Patrick

becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

Re: .Net MicroFramework compatibility ?

Postby becafuel » Tue May 25, 2010 8:50 am

It won't work in a simple manner because :
- your assemblies are not compatible with .Net MicroFramework
- .NetMF boards can't access external DLL's, so I can't use dll calls

So I'm stuck unless I'm able to decode the USB streams and write a driver for the .NetMF board. Which is beyond my abilities and my initial goal.

Please note that it is not a criticism at all. It just looks like I want to insert a square in a circle ;)

Btw, the guys that develop this board (FEZ Domino) are curious too :
FEZ guy wrote:No I am curious myself:) I may order one and try it myself

This was about motor controllers (1060 and 1062).


Here's also one question they've asked:
DLL...NET assemblies wrapper!!!! Why did they over complicate it? They should have made it emulates a keyboard then any system will be able to use it easily.

I answered that you certainely have good reasons (apart from the high number of languages available and COM support) but I ignore them as I'm not a Phidgets' or USB specialist ;)

Edit: and maybe such .NetMF boards weren't available at small prices or easily when Phidgets boards started their carreer ? Which would be _the_ answer :)

Anyway, if you have a solution, I would be (very) happy ! But I fear you don't :?


Best regards,
________
Christophe

User avatar
Patrick
Lead Developer
Posts: 3089
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: .Net MicroFramework compatibility ?

Postby Patrick » Tue May 25, 2010 9:14 am

Emulate a keyboard? That's pretty funny, would make typing pretty hard with the interfacekit spewing sensor data into your textboxes at 1000 samples a second...

At any rate, If the .NET micro framework can't load external libraries, how would it get access to hardware? This must be quite different from the compact and standard frameworks. Maybe we should look into selling a version of our SBC with WindowsCE preloaded instead of Linux, then you could use the .NET compact framework.

-Patrick

becafuel
Phidgeteer!
Posts: 86
Joined: Sat Apr 25, 2009 5:17 am
Location: France
Contact:

Re: .Net MicroFramework compatibility ?

Postby becafuel » Tue May 25, 2010 9:48 am

patrick wrote:Emulate a keyboard? That's pretty funny, would make typing pretty hard with the interfacekit spewing sensor data into your textboxes at 1000 samples a second...

I knew there was a very good reason :lol: This one was so obvious I didn't think at it at first :roll:

patrick wrote:At any rate, If the .NET micro framework can't load external libraries, how would it get access to hardware? This must be quite different from the compact and standard frameworks. Maybe we should look into selling a version of our SBC with WindowsCE preloaded instead of Linux, then you could use the .NET compact framework.

There are standard Microsoft API's to get access to low-level hardware.
Then, you can use simple generic C# code to access them :

Code: Select all

InterruptPort BoutonGauche = new InterruptPort(Cpu.Pin.GPIO_Pin0, false, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeBoth);
BoutonGauche.OnInterrupt += BoutonGauche_OnInterrupt;
BoutonGauche.EnableInterrupt();


As embedded framework is dedicated or tied to devices, I believe that the board has a specific .NetMF inside, with the device specific pinout and so on.
Then, the vendor has to provide a SDK to help accessing the board's internal in a smarter way for the end user. This can give code like this:

Code: Select all

OutputPort Led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
Led.Write(true);


All this may not be the exact way of functionning though, but it's not that far.
For what I also understand, it needs some agreement (money ?) or a kind of Partnership with Microsoft. As I'm not a board manufacturer, I admit I didn't ask for this to MS ;)

I don't know if Compact Framework can be compared to MicroFramework. But I'm only seeing this from a "client" point of vue.


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 0 guests