- Netduino Forums
- → K0demonkey's Content
K0demonkey's Content
There have been 9 items by K0demonkey (Search limited from 30-March 23)
#13230 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 13 May 2011 - 12:42 PM in Netduino 2 (and Netduino 1)
I have the Nokia 5110/3110 LCD screen and wired it up as shown on my netduino plus.
I loaded the latest code posted and when I go to debug in VS2010 and the netduino I get the following error:
Cannot find PWM.CS
A diaglog box opens and it wants me to find PWM.CS. I've searched my PC thoroughly and the file doesn't exist.
I did flash my firmware to version 4.1.0.6 hoping this would fix the issue, but it still happens.
Any help would be greatly appreciated!
Shannon
#13240 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 13 May 2011 - 05:09 PM in Netduino 2 (and Netduino 1)
Hi Shannon,
Are you running your code in the emulator or in Visual Studio?
It appears that Visual Studio is looking for the PWM managed code source. You can download that from the downloads page to make it happy if you'd like Not sure why it would want that--but you should be able to skip it as well.
Welcome to the Netduino community,
Chris
Chris,
I am running the code in Visual Studio and sending it to the netduino.
On downloads page it states:
● pwm beta C++ code coming soon
There is not a link. Am I not looking in the correct spot?
Thanks for the help.
Shan
#13245 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 13 May 2011 - 05:47 PM in Netduino 2 (and Netduino 1)
If you are stepping though the code using "Step Into" command (usually F11), try "Step Over" (F10) instead. PWM.cs is included in Netduino SDK source.
Thanks everyone. I am wondering if my issue is due to installing the 32-bit SDK instead of the 64-bit SDK on my Windows7 x64.
I've reinstalled and will try again this weekend.
Shan
#13421 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 18 May 2011 - 08:02 PM in Netduino 2 (and Netduino 1)
It looks like this:
In following AlfredBr's code [HERE] I have this board wired like this:
Nokia Pin 1: Netduino Gnd
Nokia Pin 2: Netduino 3.3v
Nokia Pin 3: Empty
Nokia Pin 4: Empty
Nokia Pin 5: D1
Nokia Pin 6: D8
Nokia Pin 7: D1
Nokia Pin 8: D5
I am no longer getting the PWM.cs error, but I still cannot get this display to work. I do see the backlight come on when I load the program to debug, but nothing is being drawn on the screen.
Is there anything else I should be looking at? This hardware stuff is totally new to me.
Shan
#13447 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 19 May 2011 - 11:27 AM in Netduino 2 (and Netduino 1)
@K0demonkey
It seems your wiring is not quite correct.
Pins 3 and 4 on the LCD are the clock pin and the data pin, you definitely need those to send data to the display.
They need to be connected to the SPI clock pin (Netduino PIN 13) and the SPI MOSI pin (Netduino PIN 11).
THANK YOU!
My next question is ... how do I print text to the screen?
I've tried Omar's code,
public class Nokia_5110 { private bool[] _offRow = new bool[84]; private readonly byte[] _pow = new byte[] { 1, 2, 4, 8, 16, 32, 64, 128 }; private OutputPort _resetPort, _daComPin; private PWM _backlightPort; private SPI _dataPort; public bool[][] _pixelMap = new bool[48][]; private byte[] _byteMap = new byte[504]; private uint _backlight = 0; private bool _invd = false, _autoRefresh = true; public Nokia_5110(Cpu.Pin chipSelect = Pins.GPIO_PIN_D3, Cpu.Pin backlight = Pins.GPIO_PIN_D9, Cpu.Pin reset = Pins.GPIO_PIN_D7, Cpu.Pin dataCommand = Pins.GPIO_PIN_D8) { SPI.Configuration spiConfiguration = new SPI.Configuration( chipSelect, // chip select port false, // IC is accessed when chip select is low 0, // setup time 1 ms 0, // hold chip select 1 ms after transfer false, // clock line is low if device is not selected true, // data is sampled at leading edge of clock 2000, // clockrate is 15 MHz SPI.SPI_module.SPI1 // use first SPI bus ); _dataPort = new SPI(spiConfiguration); _backlightPort = new PWM(backlight); _resetPort = new OutputPort(reset, true); _daComPin = new OutputPort(dataCommand, true); Initialize(); Clear(); } private void Initialize() { _resetPort.Write(false); _resetPort.Write(true); DataMode = false; _dataPort.Write(new byte[] { 0x21, 0xBF, 0x04, 0x14, 0x0C, 0x20, 0x0C }); DataMode = true; Clear(); } public void SetCursor(float x, float y) { DataMode = false; _dataPort.Write(new byte[] { (byte)(0x80 | (int)(x * 4)), (byte)(0x40 | (int)(y)) }); DataMode = true; } public void WriteText(string text, bool noSpace = true) { DataMode = true; if (noSpace) foreach (char c in text.ToCharArray()) _dataPort.Write(NokiaCharacters.ASCII[c - 0x20]); else { byte[] letter = new byte[6]; foreach (char c in text.ToCharArray()) { for (int i = 0; i < 5; i++) letter[i] = NokiaCharacters.ASCII[c - 0x20][i]; letter[5] = 0x00; _dataPort.Write(letter); } } } public void DrawRectangle(int x, int y, int width, int height, bool filled) { // thats what lines are for! oh right... I need to make a Draw line method... if (width <= 1 || height <= 1) return; int endX = x + width, endY = y + height - 2; bool[] line = new bool[84]; for (int p = x; p < endX; p++) line[p] = true; _pixelMap[y] = line; _pixelMap[endY] = line; if (!filled) { line = new bool[84]; line[x] = true; line[endX - 1] = true; } for (int h = y + 1; h < endY; h++) _pixelMap[h] = line; if (AutoRefresh) Refresh(); } public void Refresh() { int byteID = 0; for (int y = 0; y < 6; y++) { for (int x = 0; x < 84; x++) { _byteMap[byteID] = ConvertToByte(_pixelMap[y * 8][x], _pixelMap[y * 8 + 1][x], _pixelMap[y * 8 + 2][x], _pixelMap[y * 8 + 3][x], _pixelMap[y * 8 + 4][x], _pixelMap[y * 8 + 5][x], _pixelMap[y * 8 + 6][x], _pixelMap[y * 8 + 7][x]); byteID++; } } _dataPort.Write(_byteMap); SetCursor(0, 0); } private byte ConvertToByte(bool b0, bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7) { byte result = 0; result += (byte)((b7) ? _pow[7] : 0); result += (byte)((b6) ? _pow[6] : 0); result += (byte)((b5) ? _pow[5] : 0); result += (byte)((b4) ? _pow[4] : 0); result += (byte)((b3) ? _pow[3] : 0); result += (byte)((b2) ? _pow[2] : 0); result += (byte)((b1) ? _pow[1] : 0); result += (byte)((b0) ? _pow[0] : 0); return result; } public void Clear() { for (int r = 0; r < 48; r++) _pixelMap[r] = _offRow; if (_autoRefresh) Refresh(); } private void Inverse(bool inverse) { _invd = inverse; DataMode = false; _dataPort.Write(inverse ? new byte[] { 0x0D } : new byte[] { 0x0C }); DataMode = true; } public bool InverseColors { get { return _invd; } set { Inverse(value); } } private bool DataMode { get { return _daComPin.Read(); } set { _daComPin.Write(value); } } public uint BacklightBrightness { get { return _backlight; } set { if (value > 100) value = 100; _backlightPort.SetDutyCycle(value); _backlight = 100; } } public bool AutoRefresh { get { return _autoRefresh; } set { _autoRefresh = value; } } }
but the dev environment is complaining that NokiaCharacters does not exist in the current context.
#13455 LCD Help needed, 16x2s are boring
Posted by K0demonkey on 19 May 2011 - 05:14 PM in Netduino 2 (and Netduino 1)
the display is 84x84 pixels, so each character needs to be defined by a bitmap telling which bits are on and off for a given character. Here is a little background if you are interested: http://www.instructa...g-a-custom-font
If you look at the first page of this thread, on the 7th post or so at the bottom it says:
"Notes: "NokiaCharacters.ASCII" is a public static class that contains the "public static byte[] ASCII = new byte[] {....};" thing. "
Basically take the byte array called ASCII from the 5th post on the first page and put it in its own class called NokiaCharacters.
Alternatively you could put the byte array right into your code.
Hope that helps,
Mike
Mike & All ...
Thanks so much for the help. Everything works!
Now on to get to email working.
#13490 HHP IT3800 Barcode Scanner
Posted by K0demonkey on 20 May 2011 - 04:08 PM in Netduino Plus 2 (and Netduino Plus 1)
The PS/2 cable is connected to the unit via a 10 pin modular.
I would like to be able to read a barcode and dump it to the debug screen.
Once I have this figured out then I will dump the read to the Nokia 3110 LCD screen and possibly log it to the SD Card.
I have figured out Power, GND, Data, & Clock lines for the scanner.
My issue is I cannot find any wiring or code examples on how to read barcodes.
Do I want to connect the data pin on the scanner to an Analog or Digital input?
Where do I connect the clock line? Pin 13 on the netduino?
#13496 HHP IT3800 Barcode Scanner
Posted by K0demonkey on 20 May 2011 - 06:49 PM in Netduino Plus 2 (and Netduino Plus 1)
#21068 Transceiver nRF24AP1 with Trace Antenna
Posted by K0demonkey on 28 November 2011 - 01:26 PM in Netduino Plus 2 (and Netduino Plus 1)
I would like to build a small device that holds
- Transceiver nRF24AP1 with Trace Antenna
- GPS Shield
- GPS Receiver
- Cellular Shield with SM5100B
- SD Card
- LI-PO Battery
I run a bike racing team.
What I would like to do is monitor a person's HR, Speed, etc and transmit (txt msg) the data to an email address (or something). Then my server would grab the data and process it. This would allow me to keep track of my riders during a race.
There would be a Google Map and the riders icon (& possibly breadcrumb trail) would show up on the map.
Do you think this is possible?
Thanks,
Shan
- Netduino Forums
- → K0demonkey's Content
- Privacy Policy