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.

Saturnim's Content

There have been 12 items by Saturnim (Search limited from 21-April 23)


By content type

See this member's

Sort by                Order  

#14032 UART Flow Control

Posted by Saturnim on 07 June 2011 - 07:59 PM in General Discussion

Hi!
I have problem with flow control in serialPort. I am using FTDI cabel and I have connected it in this way : Tx<->Rx, CTS <-> RTS.I set handshake as request to send. In uC side I dont recive data because of I want to full up buffer. On PC side I send a lot of data in loop. I expected some error or stop of program on Write method, but PC all the time can to send data though full receiver buffor.
uC
        public static SerialPort RS;
        public static void Main()
        {
            RS = new SerialPort("COM1", 9600);
            RS.Handshake = Handshake.RequestToSend;
            //RS.DataReceived += new SerialDataReceivedEventHandler(RS_DataReceived);
            RS.Open();
            Thread.Sleep(Timeout.Infinite);
        }

        static void RS_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            byte[] inpuBuffer = new byte[RS.BytesToRead];
            RS.Read(inpuBuffer, 0, inpuBuffer.Length);
        }

PC
private static SerialPort RS;       
        static void Main(string[] args)
        {
            RS = new SerialPort("COM3", 9600);
            RS.Handshake = Handshake.RequestToSend;
            RS.WriteTimeout = Timeout.Infinite;
            
            RS.DataReceived += new SerialDataReceivedEventHandler(RS_DataReceived);
            RS.ErrorReceived += new SerialErrorReceivedEventHandler(RS_ErrorReceived);
            RS.DtrEnable = true;
            RS.RtsEnable = true;

            byte[] bytes = new byte[1024];

            for (int i = 0; i < bytes.Length; i++)
            {
                bytes[i] = (byte)i;
            }
            RS.Open();

            while (true)
            {
                RS.Write(bytes, 0, bytes.Length);
            }
        }

        static void RS_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
        {
            throw new NotImplementedException();
        }

        static void RS_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            //throw new NotImplementedException();
        }



#13998 10 Mhz pulse counter

Posted by Saturnim on 06 June 2011 - 08:05 PM in General Discussion

Probably you can to use internal counter of processor to measuring pulse. You should to read "Beginer Guid " ebook from GHI ,chapter 28 "Register access" . In this Chapter you have described exactly yours problem - counting high speed signals. But GHI is using other processors from NXP and example code will not work. You should to read datasheet of processor which you are using and then to write code.



#13783 Creating Enum instances using Reflection

Posted by Saturnim on 30 May 2011 - 07:23 PM in General Discussion

Thank you for yours replies. Mario Vernari, did you build this example ? I don't think because GetFileds returns empty array of FieldsInfo and this example throws exception. I dont understand this ... in Disassembly is showing clearly, that static fileds are existing in this enum type:
TypeDef #4 (02000005)
-------------------------------------------------------
	TypDefName: MyEnum  (02000005)
	Flags     : [NestedPublic] [AutoLayout] [Class] [Sealed] [AnsiClass]  (00000102)
	Extends   : 01000002 [TypeRef] System.Enum
	EnclosingClass : MFConsoleApplication1.Program (02000004)
	Field #1 (04000004)
	-------------------------------------------------------
		Field Name: value__ (04000004)
		Flags     : [Public] [SpecialName] [RTSpecialName]  (00000606)
		CallCnvntn: [FIELD]
		Field type:  I4

	Field #2 (04000005)
	-------------------------------------------------------
		Field Name: one (04000005)
		Flags     : [Public] [Static] [Literal] [HasDefault]  (00008056)
	DefltValue: (I4) 0
		CallCnvntn: [FIELD]
		Field type:  ValueClass MyEnum

	Field #3 (04000006)
	-------------------------------------------------------
		Field Name: two (04000006)
		Flags     : [Public] [Static] [Literal] [HasDefault]  (00008056)
	DefltValue: (I4) 1
		CallCnvntn: [FIELD]
		Field type:  ValueClass MyEnum

	Field #4 (04000007)
	-------------------------------------------------------
		Field Name: three (04000007)
		Flags     : [Public] [Static] [Literal] [HasDefault]  (00008056)
	DefltValue: (I4) 2
		CallCnvntn: [FIELD]
		Field type:  ValueClass MyEnum

Enum Declaration:
public enum MyEnum
        {
            one,
            two,
            three      
        }
Trying of getting fields:
Type TypeOfMyEnum = typeof(MyEnum);
FieldInfo[] enumFileds =  TypeOfMyEnum.GetFields(BindingFlags.Static | BindingFlags.Public );
Maybe I should use other BindingFlags? If I use NonPublic I have access to value__ but no to static fileds...



#13756 Creating Enum instances using Reflection

Posted by Saturnim on 30 May 2011 - 08:21 AM in General Discussion

I am trying to transport objects between full.Net and MF (Xml serialization). And I want to recreate object with has field enumertor. Other fields have constructor or are ValueTypes which I can create by Convert class from String ( I have all in xml) . Array can create by CreateInstance method.... but enum ?



#13736 Creating Enum instances using Reflection

Posted by Saturnim on 29 May 2011 - 11:33 AM in General Discussion

Hi! Is it possible to create an instance of enum by using reflection ? I can't to get access to constructor of my Enum and I can't create it. I tried TypeOfMyEnum.GetConstructor( new Type[]{}), TypeOfMyEnum.GetConstructor( new Type[]{typeof(Int32)}) , TypeOfMyEnum.GetMethod(".ctor")... and result is null



#13705 Reflection, Geting property

Posted by Saturnim on 28 May 2011 - 12:05 PM in General Discussion

I am writing simple xml serialization which allows to transport object between full.net and mf. Array List was an eg. of object which has hiden data. Normaly Object has data in fields. But Arrays and ArrayLists have data which access is by indexer. I want to implement something general. Something to allows me to serialize object with indexers. But in this case I cant to cast, becouse I dont know type. Therefore I thought that using of accessor to indexer may be solution. So I asked about GetProperty. But probably the best solution will be casting on interface. Thank you for your reply and code examples.



#13698 Reflection, Geting property

Posted by Saturnim on 28 May 2011 - 08:35 AM in General Discussion

Hi! I am trying to get an indexer of ArrayList by reflection. Access to indexer is by property, but I can't to find GetProperty Method. Can somebady help my? I saw using of GetProperty in this post http://forums.netdui...internal-flash/ . I am using Reflection namespace ...



#13317 Time conversion between MF and Full .Net

Posted by Saturnim on 15 May 2011 - 07:57 PM in General Discussion

It seems the documentation is incorrect, I have filled an issue on CodePlex.

I read the documentation... is incorrect



#13315 Time conversion between MF and Full .Net

Posted by Saturnim on 15 May 2011 - 06:21 PM in General Discussion

Is it really completely different or has just invalid year? In .NET Micro Framework the time origin is 1/1/1601 (vs. 1/1/1 in the 'full' .NET Framework), so you'd need to adjust it:

DateTime microDateTime = new DateTime(ticksFromFullFramework - 504911232000000000L);

This solved my problem! Thank you! And others for Interest.



#13304 Time conversion between MF and Full .Net

Posted by Saturnim on 15 May 2011 - 03:01 PM in General Discussion

I have a problem with Time conversion between platforms. I get a Ticks filed from object created in full .Net and then I create new DateTime object in MF using this value. In new object is completely diffrent date and time. Can somebody tell me how to solve this problem?



#13289 No description of classes in VS

Posted by Saturnim on 14 May 2011 - 05:36 PM in General Discussion

I had mean built-in classes eg. OutputPort from Microsoft.SPOT.Hardware and other classes from MS. Intelisense works but in Windows Form Application I have also description to each method, fields etc. In MF are only names and signature of methods... User classes with xml coments have description when i using them.



#13272 No description of classes in VS

Posted by Saturnim on 14 May 2011 - 06:40 AM in General Discussion

Welcome! I have some problem with my Visual Studio. I use VS 2010 express. When I working on Windows Form Aplication I can see class, methods,fields description but if I working on Micro Framework Apllication I can't see this. I have mean description which is generating in xml coments which starts with '///'. I am Sorry for my English. It is not my national language.




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.