Community

Netduino drives a counter chip --P3

Hello!
I’ve written, well made use of one the many existing code patterns that I’ve created over the years to drive logic to do something different:

using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace p3
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            // write your code here
            OutputPort i0 = new OutputPort(Pins.GPIO_PIN_D0, false);
            OutputPort i1 = new OutputPort(Pins.GPIO_PIN_D1, false);
            OutputPort i2 = new OutputPort(Pins.GPIO_PIN_D2, false);
            //   OutputPort i3 = new OutputPort(Pins.GPIO_PIN_D3, false);
            //   OutputPort i4 = new OutputPort(Pins.GPIO_PIN_D4, false);
            //   OutputPort i5 = new OutputPort(Pins.GPIO_PIN_D5, false);
            //   OutputPort i6 = new OutputPort(Pins.GPIO_PIN_D6, false);
            //   OutputPort i7 = new OutputPort(Pins.GPIO_PIN_D7, false);
            //   OutputPort i8 = new OutputPort(Pins.GPIO_PIN_D8, false);
            //   OutputPort i9 = new OutputPort(Pins.GPIO_PIN_D9, false);
            //   OutputPort i10 = new OutputPort(Pins.GPIO_PIN_D10, false);
            //   OutputPort i11 = new OutputPort(Pins.GPIO_PIN_D11, false);
            while (true)
            {
                  Thread.Sleep(250);
                i0.Write(false);
                //i1.Write(false);
                //i2.Write(false);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(false);
                //     i4.Write(false);
                //     i5.Write(false);
                //     i6.Write(false);
                //     i7.Write(false);
                //     i8.Write(false);
                //     i9.Write(false);
                //     i10.Write(false);
                //     i11.Write(false);
                  Thread.Sleep(250);
                i0.Write(false);
                //i1.Write(true);
                //i2.Write(true);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(true);
                //     i4.Write(true);
                //     i5.Write(false);
                //     i6.Write(false);
                //     i7.Write(false);
                //     i8.Write(false);
                //     i9.Write(false);
                //     i10.Write(false);
                //     i11.Write(false);
                Thread.Sleep(250);
                i0.Write(false);
                //i1.Write(true);
                //i2.Write(true);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(true);
                //     i4.Write(false);
                //     i5.Write(false);
                //     i6.Write(false);
                //     i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(false);
                //    i11.Write(false);
                Thread.Sleep(250);
                i0.Write(false);
                //     i1.Write(false);
                //     i2.Write(true);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(false);
                //     i4.Write(false);
                //     i5.Write(false);
                //     i6.Write(false);
                //    i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(true);
                //    i11.Write(true);
                Thread.Sleep(250);
                i0.Write(false);
                //    i1.Write(false);
                //    i2.Write(false);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(false);
                //     i4.Write(true);
                //     i5.Write(false);
                //     i6.Write(false);
                //    i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(true);
                //    i11.Write(true);
                Thread.Sleep(250);
                i0.Write(false);
                //     i1.Write(false);
                //     i2.Write(false);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(false);
                //     i4.Write(false);
                //     i5.Write(true);
                //     i6.Write(false);
                //    i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(true);
                //    i11.Write(true);
                  Thread.Sleep(250);
                i0.Write(false);
                //     i1.Write(false);
                //     i2.Write(false);
                Thread.Sleep(250);
                i0.Write(true);
                //     i3.Write(false);
                //     i4.Write(false);
                //      i5.Write(false);
                //      i6.Write(true);
                //    i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(true);
                //    i11.Write(true);
                Thread.Sleep(250);
                i0.Write(false);
                Thread.Sleep(250);
                i1.Write(false);
                //    i2.Write(false);
                i0.Write(true);
                Thread.Sleep(250);
                i1.Write(true);
                //    i3.Write(false);
                //    i4.Write(false);
                //    i5.Write(false);
                //    i6.Write(false);
                //    i7.Write(true);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(true);
                //    i11.Write(true);
                //        Thread.Sleep(250);
                i0.Write(false);
                //     i1.Write(false);
                //     i2.Write(false);
                Thread.Sleep(250);
                i0.Write(true);
                //  i3.Write(false);
                //  i4.Write(false);
                //  i5.Write(false);
                //  i6.Write(false);
                //    i7.Write(false);
                //    i8.Write(false);
                //    i9.Write(false);
                //    i10.Write(false);
                //    i11.Write(true);
                Thread.Sleep(250);

            }

        }
    }
}

As it runs the ones coded as Output 0 sends a pulse to the clock input for an SN74LS163 counter, and then sends one to a counting enable input. The end result has the process drive a HEX display, such as a HDSP-0963. The counter is also seen driving four amber LEDs they display the standard cycle. I see attachments are not allowed on this forum but I can make available copies of my datasheets via my registered address. I invite comments. I should also add that I have the device a Netduino 3 being powered by the on-the-breadboard power supply since it contains a USB connector who produces the 5 volts out.

A follow up! The same idea was used to try and drive the same counter, using a BASIC Stamp from Parallax. It used as its base a program originally written to respond to a TI TI83Plus Calculator. It seems something wasn’t working witnin the timing of the program flow as the counter didn’t properly sequence. Whereas here it certain is allowed to sequence.