Main Site Documentation

FEZ Mini and Serial Comms


#1

Hi Folks.
I’m starting to work on the overall functionality of my project as in communication between different modules etc.

One of these boards will send information to the Mini via a TTL level serial connection. There will only be 5 characters sent at a time.

Now I understand that the COMS on the mini are interrupt driven and I am looking for some code examples that will enable the Mini to do other tasks yet monitor the Comms in the background.
When comms are recieved then the Mini can check the information and either use it or dicard it.

There are many ways I could do this but I am trying to find the best way that works in with the Mini phliosophy.

I can either

1, Have a thread that watches the Comms - checking for any incoming characters and then process them. If there is a correct sequence then a global flag is set casing the main routine to perform another task.

  1. When a Comms event occurs the main thread jumps to a checker and processes it, then returns back to the main thread.

Any advice on this be most appreciated. I’m not looking for someone to write the code for me but I am looking for idea’s on how best to design applications on the NETMF

Many thanks
Dave


#2

Events may be better.

See if this helps

http://www.tinyclr.com/forum/2/208/

on http://www.tinyclr.com/downloads/Extension/FEZ_Extensions_GPS.cs look at


_port.DataReceived += new SerialDataReceivedEventHandler(_port_DataReceived);

#3

Many thanks Rajesh

Just what I was looking for - some code examples on the best way to do something.

Take Care
Dave