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.
Photo

soft parallel port

parallel port

  • Please log in to reply
1 reply to this topic

#1 stotech

stotech

    Advanced Member

  • Members
  • PipPipPip
  • 143 posts
  • LocationAustralia

Posted 02 October 2014 - 09:54 AM

Please don't dump on me about it's speed, I know it will be slow. But i'm just doing a really quick proof of concept at the moment and a need a soft parallel port for a ks0108 display.

 

I've got a great working library for it that i've used over SPI using the netmf toolbox but this needs to be over gpio's.

 

this is what I've got but it is failing with a null reference exception at line 18, gosh i feel like a dummy.

{
    public class SoftParallel
    {
        OutputPort[] bit_;

        public SoftParallel(OutputPort bit_0, 
                                        OutputPort bit_1, 
                                        OutputPort bit_2, 
                                        OutputPort bit_3,   
                                        OutputPort bit_4,
                                        OutputPort bit_5, 
                                        OutputPort bit_6, 
                                        OutputPort bit_7,
                                        bool invert)
        {
            if (!invert)
            {
                this.bit_[0] = bit_0;
                this.bit_[1] = bit_1;
                this.bit_[2] = bit_2;
                this.bit_[3] = bit_3;
                this.bit_[4] = bit_4;
                this.bit_[5] = bit_5;
                this.bit_[6] = bit_6;
                this.bit_[7] = bit_7;
            }
            else
            {
                this.bit_[0] = bit_7;
                this.bit_[1] = bit_6;
                this.bit_[2] = bit_5;
                this.bit_[3] = bit_4;
                this.bit_[4] = bit_3;
                this.bit_[5] = bit_2;
                this.bit_[6] = bit_1;
                this.bit_[7] = bit_0;
            }
        }

        public void Write(byte data)
        {
            for (int Counter = 0; Counter < 8; ++Counter)
            {
                bit_[Counter].Write(data.GetBit(Counter));
            }
        }
    }
}

thanks in advance.



#2 stotech

stotech

    Advanced Member

  • Members
  • PipPipPip
  • 143 posts
  • LocationAustralia

Posted 02 October 2014 - 12:34 PM

OutputPort[] bit_;

 

neeeded to be

 

OutputPort[] bit_ = new OutputPort[8];

 

Don't ask me why....Trial and error solved it.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.