Hi folks,
I'm spending my first "real" day with the Netduino 2 Plus. I've got a 4x20 OLED character display from New Haven (NHD-0420DZW-AY5). This is a similar display to ones we use in some of our products with Rabbit micros. In other products we use these displays in 8-bit parallel mode and hang them on the Rabbit data bus, but I'm trying to conserve pins on my Netduino so I thought I could re-configure the display for SPI as per the data sheet.
My difficulty is that the the command words for the display are 10-bits wide (RS, RW, D7..D0). I'm a little foggy about how to send a 10-bit word via the SPI class. It looks like there is an overload for SPI#WriteRead that accepts a writeOffset & writeCount, so I thought perhaps I could hand it a 16-bit value with an writeOffset=0 and a writeCount=10. This is a code snippet:
public static void InitOLED() { UInt16[] readBuffer = new UInt16[1]; var config = new SPI.Configuration(Pins.GPIO_PIN_A4, false, 150, 150, true, true, ((1/3) * 10000), SPI_Devices.SPI1 ); _oled = new SPI(config); Thread.Sleep(100); //Display OFF _oled.WriteRead(new UInt16[] { 0x08 }, 0, 10, readBuffer, 0, 8, 0);
When run, the last line that contains the WriteRead call generates the following exception:
An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.SPOT.Hardware.dll
I'm clearly doing something silly, but can't see what I've done wrong. Any help would be greatly appreciated. Thanks!