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.

iliak

Member Since 10 Jan 2011
Offline Last Active Nov 02 2011 12:33 PM
-----

Posts I've Made

In Topic: 1024D switch led panel documentation

21 May 2011 - 08:34 AM

After a good night, here's a first working version :

public class Program
	{
		static OutputPort Data1;
		static OutputPort Data2;
		static OutputPort Data3;
		static OutputPort Clock;
		static InputPort Button;

		public static void Main()
		{
			Data1 = new OutputPort(Pins.GPIO_PIN_D0, false);
			Data2 = new OutputPort(Pins.GPIO_PIN_D1, false);
			Data3 = new OutputPort(Pins.GPIO_PIN_D2, false);
			Clock = new OutputPort(Pins.GPIO_PIN_D7, false);

			Button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);

			while (true)
			{
				byte size = 16;
				for (int i = 0; i >= 0 && i < size; i++)
				{

					// Lower Clock
					Clock.Write(false);

					for (var b = 0; b < size; b++)
					{
						int mask = 1 << (size - 1) - b;

						var pinState = (mask & 1 << i) != 0;

						// Write data bit
						Data1.Write(pinState);
						Data2.Write(pinState);
						Data3.Write(pinState);

						// Pulse Clock
						Clock.Write(true);

						// Raise Data to prevent IO conflict 
						Data1.Write(true);
						Data2.Write(true);
						Data3.Write(true);

						Clock.Write(false);
					}



					Thread.Sleep(250);
					//while (Button.Read()) ;
					//while (!Button.Read()) ;
				}
			}
		}
	}

D0, D1 & D2 are connected to data pins
D7 is connected to all clock pins

Is there any source code repository for NetDuino projects I can post the source ?

In Topic: 1024D switch led panel documentation

20 May 2011 - 09:45 PM

This module can be interfaced to Netduino via SPI - just wire clock and data signals and send 16 bits with LED states. 3.3V should be enough for logic H, if the module is powered by 5V.


I can't find any source code / tutorial on this part. Could you show me how to do this please ?

According to this :
Posted Image

Here's how I do :
D0, D1 & D2 => data1, data2, data3
D5, D6 & D7 => clock1, clock2, clock3
Gnd & +5V

using System;
using System.Diagnostics;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace NetduinoApplication1
{
	public class Program
	{
		public static void Main()
		{
			var button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);

			// write your code here
			OutputPort Data1 = new OutputPort(Cpu.Pin.GPIO_Pin0, false);
			OutputPort Data2 = new OutputPort(Cpu.Pin.GPIO_Pin1, false);
			OutputPort Data3 = new OutputPort(Cpu.Pin.GPIO_Pin2, false);
			OutputPort Clock3 = new OutputPort(Cpu.Pin.GPIO_Pin5, false);
			OutputPort Clock1 = new OutputPort(Cpu.Pin.GPIO_Pin6, false);
			OutputPort Clock2 = new OutputPort(Cpu.Pin.GPIO_Pin7, false);

			//SPI.Configuration conf = new SPI.Configuration(Cpu.Pin.GPIO_Pin8, false, 0, 0, true, false, 1000, SPI.SPI_module.SPI1);
			//SPI spi = new SPI(conf);

			byte i = 0;
			while (true)
			{

				i++;
				if (i >= byte.MaxValue)
					i = 0;


				//spi.Write(new byte[] { 0x21, 0xBF, 0x04, 0x14, 0x0C, 0x20, 0x0C });


				shiftOut(Data1, Clock1, i);
				shiftOut(Data2, Clock2, i);
				shiftOut(Data3, Clock3, i);

				Thread.Sleep(100);

				//spi.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 });

				shiftOut(Data1, Clock1, 0);
				shiftOut(Data2, Clock2, 0);
				shiftOut(Data3, Clock3, 0);
			}
		}


		/// <summary>
		/// Shift out override (Reverse clock HIGH/LOW)
		/// </summary>
		/// <param name="data"></param>
		/// <param name="clock"></param>
		/// <param name="val"></param>
		static void shiftOut(OutputPort data, OutputPort clock, byte val)
		{

			for (int i = 0; i < 8; i++)
			{
				clock.Write(false);
				data.Write(!((val & (1 << (7 - i))) == 1));
				clock.Write(true);
			}
		}

	}
}

In Topic: 1024D switch led panel documentation

20 May 2011 - 10:01 AM

Interesting post...

In Topic: 1024D switch led panel documentation

19 May 2011 - 08:15 PM

Just to be sure you don't miss the edit of my previous post, where I made a mistake. The LEDs are connected to +5V (through the resistors) and shift registers act as current sinks - they has to output logic '0' to turn a LED on.


Your guess were corrects, I can light leds. My next step is to use the FC-19P connector.

In Topic: 1024D switch led panel documentation

19 May 2011 - 05:38 PM

I have drawn some of the connections mentioned in the previous post in the attached image (cyan text is "Serial Data (16 bits)").

Edit: I've made a mistake, the resistor net pads "+5V here to turn on the LEDs" seem to be connected together - so it is in all likelihood already connected to +5V and the LEDs needs to be turned on by connecting the opposite side to the ground.


You read my mind, a picture worth hundreds words !!
Thanks.

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.