Download "user manual"

Transcript
Beginners guide to C# and .NET Micro Framework
Table of Contents
1.Change Log........................................................4
2.About the Book..................................................5
2.1.Intended Audience.....................................5
2.2.Translating the Book..................................5
3.Introduction.......................................................6
3.1.Advantages.................................................6
4.Porting...............................................................7
4.1.GHI Standard Offers..................................7
5.Selecting a Device.............................................8
5.1.ChipworkX Module...................................8
5.2.EMX Module.............................................9
5.3.USBizi Chipset..........................................9
5.4.FEZ Family..............................................10
FEZ Domino and FEZ Mini......................10
FEZ Cobra.................................................12
Other Devices............................................13
6.Getting Started.................................................14
6.1.System Setup............................................14
6.2.The Emulator...........................................14
Create a Project.........................................14
Selecting Transport...................................16
Executing...................................................17
Breakpoints...............................................18
6.3.Running on Hardware..............................19
MFDeploy can Ping!.................................19
Deploying to Hardware.............................20
7.Component Drivers..........................................21
8.C# Level 1.......................................................22
8.1.What is .NET?..........................................22
8.2.What is C#?..............................................22
“Main” is the Starting Point......................22
Comments.................................................23
while-loop.................................................24
Variables...................................................25
Assemblies................................................27
What Assemblies to Add?.........................30
Threading..................................................31
9.Digital Input & Output....................................34
9.1.Digital Outputs.........................................34
Blink an LED............................................36
9.2.Digital Inputs...........................................37
Copyright © 2010 GHI Electronics, LLC
9.3.Interrupt Port............................................39
9.4.Tristate Port..............................................40
10.C# Level 2.....................................................42
10.1.Boolean Variables..................................42
10.2.if-statement............................................44
10.3.if-else-statements...................................45
10.4.Methods and Arguments........................47
10.5.Classes...................................................49
10.6.Public vs. Private...................................49
10.7.Static vs. non-static................................50
10.8.Constants................................................50
10.9.Enumeration...........................................51
11.Assembly/Firmware Matching......................53
Boot-up Messages.....................................53
12.Pulse Width Modulation................................55
Simulating PWM.......................................57
Controlling Servo Motors and Fine-tune the
PWM.........................................................57
12.1.Piezo.......................................................59
13.Glitch filter....................................................60
14.Analog input & output...................................61
14.1.Analog Inputs.........................................61
14.2.Analog Outputs......................................62
15.Garbage Collector..........................................64
15.1.Losing Resources...................................65
15.2.Dispose...................................................66
15.3.GC Output Messages.............................67
16.C# Level 3.....................................................68
16.1.Byte........................................................68
16.2.Char........................................................68
16.3.Array......................................................69
16.4.String......................................................70
16.5.For-Loop................................................71
16.6.Switch Statement...................................73
17.Serial Interfaces.............................................76
17.1.UART.....................................................76
17.2.SPI..........................................................80
17.3.I2C.........................................................82
17.4.One Wire................................................83
17.5.CAN.......................................................84
18.Output Compare............................................87
Page 2/170