Multiplex shield, experiences?
#1
Posted 10 March 2011 - 10:52 AM
Since I want to do a bit more in the line of robotics, I am thinking about the amount of I/O-ports.
It will probably be possible to do with only the current amount, but if there were more ports, things would be much easier.
I found out that a Mux Shield could be useful then. But all I find is code for the Arduino, which isn't in C#. Has anyone already got some experience with multiplex shields on a Netduino? Is it easy to adapt code to use a multiplex shield?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#2
Posted 10 March 2011 - 11:35 AM
#3
Posted 14 March 2011 - 09:59 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#4
Posted 14 March 2011 - 11:19 AM
#5
Posted 14 March 2011 - 11:28 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#6
Posted 14 March 2011 - 12:41 PM
#7
Posted 14 March 2011 - 12:55 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 14 March 2011 - 01:16 PM
#9
Posted 14 March 2011 - 02:27 PM
This is slightly off-topic, but I just would like to point out that the port access itself is very fast (see GPIO speed (MHz), BitBasher threads), it is the CIL interpreter that takes hundreds (or maybe thousands) of instructions to execute the IL opcodes. Unlike its 'bigger brothers', .NET Micro Framework does not have neither Just-In-Time compiler(*) nor native image generator that can translate IL into assembly (native code) - there is a lot happening between port.Write(...) and PIO_CODR/PIO_SODR register access ;-)The N MCU is a kind of nuke, it seems almost impossible that a port read/write takes hundreds of microseconds. I think should take hundreds of nanoseconds!
(*) Actually, the JIT is there, but it is not enabled, mainly due to flash memory-related issues (size constraints, repetitious reflashing etc.).
#10
Posted 14 March 2011 - 02:45 PM
#11
Posted 14 March 2011 - 02:53 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#12
Posted 14 March 2011 - 03:20 PM
You can use PWM to control motors. For servos, there are several samples in the forum, please have a look at e.g. Chris Seto's Netduino servo class. Similarly, DC motors can be operated by H-Bridge circuits that usually take PWM input to control the speed (there is currently one issue with fixed PWM frequency at 10 kHz that may causes motors to 'hum', because it is in audible range - this will be fixed in the next firmware versions). Hope this helps.Anyway, let's get back to Stefan: he's going to motorize his N app. What about shaping the speed/position of ONE-single motor?...Either he has a very slow speed, or he must use an external logic.
I really can't see other ways.
#13
Posted 14 March 2011 - 03:22 PM
Thanks CW2, I will look into it as soon as the servos arrive. As I explained, since I'm a cheap guy I have to patient though, so until then I will work on several projects for educational purposes.You can use PWM to control motors. For servos, there are several samples in the forum, please have a look at e.g. Chris Seto's Netduino servo class. Similarly, DC motors can be operated by H-Bridge circuits that usually take PWM input to control the speed (there is currently one issue with fixed PWM frequency at 10 kHz that may causes motors to 'hum', because it is in audible range - this will be fixed in the next firmware versions). Hope this helps.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#14
Posted 14 March 2011 - 07:01 PM
Curiously, Hack a Day just published an article that links to Interactive 595 Shift Register Simulator...first I have to find out how to use the 74HC59x's
#15
Posted 14 March 2011 - 08:25 PM
Yes there is a resistor on the breadboard, and I had only one led burning at all time
Code:
SPI SPI_Out = new SPI(new SPI.Configuration( Pins.GPIO_PIN_D10, false, 0, 0, false, false, 1000, SPI.SPI_module.SPI1 )); byte[] writebuffer = new byte[1]; while (true) { writebuffer[0] = 0; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 1; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 2; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 4; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 8; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 16; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 32; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 64; SPI_Out.Write(writebuffer); Thread.Sleep(100); writebuffer[0] = 128; SPI_Out.Write(writebuffer); Thread.Sleep(100); }
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#16
Posted 16 March 2011 - 08:26 AM
The blinking led example would be translated like this:
// Initializes the 74HC595 IC Ic74HC595 IcOut = new Ic74HC595(Pins.GPIO_PIN_D10, SPI.SPI_module.SPI1); // Defines the outputport, mind the last parameter, referring to the 74HC595 IC OutputPort595 led = new OutputPort595(Ic74HC595.Pins.GPO_PIN_D0, false, IcOut); while (true) { led.Write(!led.Read()); Thread.Sleep(500); }
I think the 597 will be harder, since I also want to support interrupts, but that's a challenge for the upcoming week. Today I'll get 2 597s and an additional 595 to toy with
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#17
Posted 16 March 2011 - 11:57 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#18
Posted 16 March 2011 - 12:44 PM
I think the 597 will be harder, since I also want to support interrupts
Hi Stefan. I wouldn't be sure that managing the 597 inputs as they were really independent would be a good bet. Formally it is surely a good move, but consider how bad performing would be.
Instead, for example, I'd link two 597 in pipeline so that, with a very fast operation, the Netduino will get 16 bits at once.
Throwing many int's will stuck the application, I guess.
Unfortunately I'm realizing that all the sweet things learned for programming abstraction would be taken as we were diabetics (correct in english?)
Good luck.
Mario
#19
Posted 16 March 2011 - 12:49 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#20
Posted 16 March 2011 - 01:17 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users