- Netduino Forums
- → Coding Smackdown's Content
Coding Smackdown's Content
There have been 72 items by Coding Smackdown (Search limited from 15-May 23)
#21222 General Listing of Netduino Resources
Posted by Coding Smackdown on 01 December 2011 - 03:22 PM in General Discussion
#21233 General Listing of Netduino Resources
Posted by Coding Smackdown on 01 December 2011 - 08:48 PM in General Discussion
#21403 Fix It Shield
Posted by Coding Smackdown on 06 December 2011 - 07:39 PM in Project Showcase
#21491 Ethernet stop working after around 20-60 minutes running
Posted by Coding Smackdown on 08 December 2011 - 08:17 PM in Netduino Plus 2 (and Netduino Plus 1)
I studied the NETduino HW a bit and found that DM9161A chip performs autonegotiation for Ethernet link establishment autonomously.
I'm wondering if maybe you've come across something that has always plagued systems. I know in the windows world auto negotiation has always been problem some for devices and I have worked with network technicians who have recommended that it be turned off.
Maybe we should look at adding the capability to set the port speed on the Netduino Plus. If the network folks are having people turn it off, maybe we need to provide similar capabilities to allow the device to coexist with all of the other devices on the network.
#35076 Documentation
Posted by Coding Smackdown on 12 September 2012 - 09:33 PM in General Discussion
#20974 Digital I/Os during power up
Posted by Coding Smackdown on 25 November 2011 - 04:14 PM in Netduino 2 (and Netduino 1)
Later in this tutorial I also will describe how one can use FET/MOSFET, DIOD or Transistor NAND as well as NAND TTL IC to achieve same.
Wouldn't an XOR Gate work better than a NAND Gate? I would think you would only want a high output when the two input are different. So if the Netduino board sets all pins to high at reset you could hook up one input to the Netduino pin you are going to use as a switching signal and the second to positive voltage. This way when the board resets both inputs would be high and the output would stay low. Then once your application starts you could drive the Netduino pin low to get a high output from the XOR Gate thus providing the voltage required to allow current to flow through the transistor.
Or do I have my logic backwards and you need the NAND gate to keep the signal high so there is not enough difference at the base of the transistor to allow current to flow?
Regards,
Jim Lavin
#20975 Digital I/Os during power up
Posted by Coding Smackdown on 25 November 2011 - 04:24 PM in Netduino 2 (and Netduino 1)
#21256 Dear Netduino developers, where are you from? :)
Posted by Coding Smackdown on 02 December 2011 - 01:15 PM in General Discussion
#36594 Converting existing programs from 4.1 to 4.2
Posted by Coding Smackdown on 05 October 2012 - 08:53 PM in Visual Studio
#21525 Convert byte[4] to float
Posted by Coding Smackdown on 09 December 2011 - 11:08 PM in Netduino 2 (and Netduino 1)
#30214 Brewing Beer with a Netduino Plus
Posted by Coding Smackdown on 05 June 2012 - 05:13 AM in Project Showcase
#21130 Boost Application Memory by 10-15%
Posted by Coding Smackdown on 29 November 2011 - 10:26 PM in Netduino Plus 2 (and Netduino Plus 1)
#35119 Beerbrew Controller
Posted by Coding Smackdown on 13 September 2012 - 01:30 PM in General Discussion
#35125 Beerbrew Controller
Posted by Coding Smackdown on 13 September 2012 - 02:10 PM in General Discussion
#37248 Application freezing on Socket creation
Posted by Coding Smackdown on 15 October 2012 - 08:42 PM in Netduino Plus 2 (and Netduino Plus 1)
#21025 Analog reading accuracy
Posted by Coding Smackdown on 27 November 2011 - 03:38 PM in General Discussion
Did you try the usual methods to stabilize the voltages, like in http://highfieldtale...highfieldtales/ - connect aref to 3v3 via a inductor, use a (fast) capacitor between aref and ground and a "big" one between 3v3 and ground?
Stefan,
That is a really good article, I never realized how much noise was going on. Being pretty rusty with electronics do you have a sample schematic that shows what your final solution was to filter out the noise?
Thanks,
Jim Lavin
#35512 Adafruit 20x2 Character VFD (Vacuum Fluorescent Display) - SPI interface - 20...
Posted by Coding Smackdown on 19 September 2012 - 12:44 AM in General Discussion
http://www.adafruit.com/products/347
I was hoping to use it an one of my controller projects. I based my driver off of the MicroLiquidCrystal Shifter74Hc595LcdTransferProvider and the LCD class. I made changes based on the datasheets, but I'm having to send data and commands twice in order to get the controller to recognize what I'm sending.
I'm thinking maybe my SPI configuration is setup incorrectly, but I haven't been able to find too much about how to configure the SPI port.
I've included the code below, in case anyone can figure it out.
Thanks!
using System;
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
//
// SPI Vacum Flouresent Display Driver
// Based on the SPI_VFD Arduino Library
// Created by AdaFruit
//
namespace CodingSmackdown.Drivers
{
// When the display powers up, it is configured as follows:
//
// 1. Display clear
// 2. Function set:
// N = 1; 2-line display
// BR1=BR0=0; (100% brightness)
// 3. Display on/off control:
// D = 0; Display off
// C = 0; Cursor off
// B = 0; Blinking off
// 4. Entry mode set:
// I/D = 1; Increment by 1
// S = 0; No shift
//
// Note, however, that resetting the Arduino doesn't reset the LCD, so we
// can't assume that its in that state when a sketch starts (and the
// SPI_VFD constructor is called).
public class SPI_VFDisplay : IDisposable
{
// commands
private const byte VFD_CLEARDISPLAY = 0x01;
private const byte VFD_RETURNHOME = 0x00;
private const byte VFD_ENTRYMODESET = 0x04;
private const byte VFD_DISPLAYCONTROL = 0x08;
private const byte VFD_CURSORSHIFT = 0x10;
private const byte VFD_FUNCTIONSET = 0x30;
private const byte VFD_SETCGRAMADDR = 0x40;
private const byte VFD_SETDDRAMADDR = 0x80;
// flags for display entry mode
private const byte VFD_ENTRYRIGHT = 0x00;
private const byte VFD_ENTRYLEFT = 0x02;
private const byte VFD_ENTRYSHIFTINCREMENT = 0x01;
private const byte VFD_ENTRYSHIFTDECREMENT = 0x00;
// flags for display on/off control
private const byte VFD_DISPLAYON = 0x04;
private const byte VFD_DISPLAYOFF = 0x00;
private const byte VFD_CURSORON = 0x02;
private const byte VFD_CURSOROFF = 0x00;
private const byte VFD_BLINKON = 0x01;
private const byte VFD_BLINKOFF = 0x00;
// flags for display/cursor shift
private const byte VFD_DISPLAYMOVE = 0x08;
private const byte VFD_CURSORMOVE = 0x00;
private const byte VFD_MOVERIGHT = 0x04;
private const byte VFD_MOVELEFT = 0x00;
// flags for function set
private const byte VFD_2LINE = 0x08;
private const byte VFD_1LINE = 0x00;
private const byte VFD_SPICOMMAND = 0xF8;
private const byte VFD_SPIDATA = 0xFA;
private byte _linemode;
private byte _brightness;
private byte _displaycontrol;
private byte _shiftmode;
private byte _incrementmode;
private byte _displaymode;
private byte _cursormode;
private byte _blinkmode;
private byte _initialized;
private byte _numlines;
private byte _currline;
private readonly SPI _spi;
private readonly OutputPort _latchPort;
readonly byte[] _writeBuf = new byte[1];
public enum Brightness
{
VFD_BRIGHTNESS25 = 0x03,
VFD_BRIGHTNESS50 = 0x02,
VFD_BRIGHTNESS75 = 0x01,
VFD_BRIGHTNESS100 = 0x00
}
public SPI_VFDisplay(SPI.SPI_module spiBus, Cpu.Pin latchPin, Brightness brightness)
{
var spiConfig = new SPI.Configuration(
Cpu.Pin.GPIO_NONE, //latchPin,
false, // active state
0, // setup time
0, // hold time
false, // clock idle state
true, // clock edge
1000, // clock rate
spiBus);
_spi = new SPI(spiConfig);
_latchPort = new OutputPort(latchPin, true);
//default to 2x20 display (SAMSUNG 20T202DA2JA)
begin(20, 2, brightness);
}
public void begin(byte columns, byte lines, Brightness brightness)
{
// set number of lines
if (lines > 1)
_linemode = VFD_2LINE;
else
_linemode = VFD_1LINE;
// save off for address translation
_numlines = lines;
// turn the display on with no cursor or blinking default
_displaycontrol = VFD_DISPLAYON;
_cursormode = VFD_CURSORON;
_blinkmode = VFD_BLINKOFF;
_shiftmode = VFD_ENTRYLEFT;
_incrementmode = VFD_ENTRYSHIFTDECREMENT;
// init the display
display();
//catch bad values
if (brightness > Brightness.VFD_BRIGHTNESS25)
_brightness = (byte)Brightness.VFD_BRIGHTNESS100;
else
_brightness = (byte)brightness;
// set the brightness and push the linecount with VFD_SETFUNCTION
setBrightness(brightness);
// set cursor shift for romance lnaguages
leftToRight();
// clear the display
clear();
// set starting address to column 0, row 0
home();
}
public void setBrightness(Brightness brightness)
{
// set the brightness (only if a valid value is passed
if (brightness <= Brightness.VFD_BRIGHTNESS25)
{
_brightness = (byte)brightness;
command((byte)(VFD_FUNCTIONSET | _brightness | _linemode));
}
}
public byte getBrightness()
{
// get the brightness
return (byte)(_brightness);
}
public void clear()
{
command(VFD_CLEARDISPLAY); // clear display, set cursor position to zero
}
public void home()
{
command(VFD_SETDDRAMADDR | 0x00); // set cursor position to zero
}
public void setCursor(byte col, byte row)
{
int[] row_offsets = { 0x00, 0x40, 0x14, 0x54 };
if (row > _numlines)
{
row = (byte)(_numlines - 1); // we count rows starting w/0
}
// we only have 20 columns even though there are 40 cols addressable
if (col > 20)
{
col = 20;
}
int address = col + row_offsets[row];
command((byte)(VFD_SETDDRAMADDR | address));
}
// Turn the display on/off (quickly)
public void noDisplay()
{
_displaycontrol = VFD_DISPLAYOFF;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
public void display()
{
_displaycontrol = VFD_DISPLAYON;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
// Turns the underline cursor on/off
public void noCursor()
{
_cursormode = VFD_CURSOROFF;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
public void cursor()
{
_cursormode = VFD_CURSORON;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
// Turn on and off the blinking cursor
public void noBlink()
{
_blinkmode = VFD_BLINKOFF;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
public void blink()
{
_blinkmode = VFD_BLINKON;
command((byte)(VFD_DISPLAYCONTROL | _displaycontrol | _cursormode | _blinkmode));
}
// These commands scroll the display without changing the RAM
public void scrollDisplayLeft()
{
command((byte)(VFD_CURSORSHIFT | VFD_DISPLAYMOVE | VFD_MOVELEFT));
}
public void scrollDisplayRight()
{
command((byte)(VFD_CURSORSHIFT | VFD_DISPLAYMOVE | VFD_MOVERIGHT));
}
// This is for text that flows Left to Right
public void leftToRight()
{
_shiftmode = VFD_ENTRYLEFT;
command((byte)(VFD_ENTRYMODESET | _shiftmode | _incrementmode));
}
// This is for text that flows Right to Left
public void rightToLeft()
{
_shiftmode = VFD_ENTRYRIGHT;
command((byte)(VFD_ENTRYMODESET | _shiftmode | _incrementmode));
}
// This will 'right justify' text from the cursor
public void autoscroll()
{
_incrementmode = VFD_ENTRYSHIFTINCREMENT;
command((byte)(VFD_ENTRYMODESET | _shiftmode | _incrementmode));
}
// This will 'left justify' text from the cursor
public void noAutoscroll()
{
_incrementmode = VFD_ENTRYSHIFTDECREMENT;
command((byte)(VFD_ENTRYMODESET | _shiftmode | _incrementmode));
}
// Allows us to fill the first 8 CGRAM locations
// with custom characters
public void createChar(byte location, byte[] charmap)
{
location &= 0x7; // we only have 8 locations 0-7
command((byte)(VFD_SETCGRAMADDR | (location << 3)));
for (int i = 0; i < 8; i++)
{
write(charmap[i]);
}
}
// spool string data to the display
public void print(string data)
{
byte[] output = System.Text.Encoding.UTF8.GetBytes(data);
for (int i = 0; i < output.Length; i++)
{
write(output[i]);
}
}
/*********** mid level commands, for sending data/cmds, init */
private void command(byte value)
{
_latchPort.Write(false);
_writeBuf[0] = VFD_SPICOMMAND;
_spi.Write(_writeBuf);
_writeBuf[0] = value;
_spi.Write(_writeBuf);
_latchPort.Write(true);
Thread.Sleep(1);
_latchPort.Write(false);
_writeBuf[0] = VFD_SPICOMMAND;
_spi.Write(_writeBuf);
_writeBuf[0] = value;
_spi.Write(_writeBuf);
_latchPort.Write(true);
Thread.Sleep(1);
}
private void write(byte value)
{
_latchPort.Write(false);
_writeBuf[0] = VFD_SPIDATA;
_spi.Write(_writeBuf);
_writeBuf[0] = value;
_spi.Write(_writeBuf);
_latchPort.Write(true);
Thread.Sleep(1);
_latchPort.Write(false);
_writeBuf[0] = VFD_SPIDATA;
_spi.Write(_writeBuf);
_writeBuf[0] = value;
_spi.Write(_writeBuf);
_latchPort.Write(true);
Thread.Sleep(1);
}
public void Dispose()
{
_spi.Dispose();
_latchPort.Dispose();
}
}
}
#36761 Adafruit 20x2 Character VFD (Vacuum Fluorescent Display) - SPI interface - 20...
Posted by Coding Smackdown on 08 October 2012 - 07:50 AM in General Discussion
#37333 2D navigation using Triliteration
Posted by Coding Smackdown on 17 October 2012 - 06:23 PM in General Discussion
#37982 'AnalogInput' is an ambiguous reference after 4.2 RC1
Posted by Coding Smackdown on 26 October 2012 - 01:16 PM in Beta Firmware and Drivers
#30373 "Advanced HMI" open source HMI development
Posted by Coding Smackdown on 07 June 2012 - 06:06 PM in General Discussion
#30639 "Advanced HMI" open source HMI development
Posted by Coding Smackdown on 13 June 2012 - 09:03 PM in General Discussion
Hello Bryan.
Here the answers:
Hope it helps.
- no, I'm not familiar with *that* project, although we're developing our own, which is similar;
- yes, you should able to interface easily with a Netduino just leveraging my Modbus library.
Cheers
Mario,
I have a couple of questions for you about your Modbus library. Being new to the whole world of Modbus, let me give you a little background as to what I want to do with it and maybe you can steer me in the right direction.
I'd like to use it to control my Electric Brew Kettle's heating element by setting the target temperature I want to reach and then read back the current temperature and whether the element is on or off.
As for setting the target temperature and reading the current temperature and if the element is on or off, I'm thinking I could use the ReadRegisters and SetRegister methods.
I've also been working on porting over the Arduino PID Library to provide a better control algorithm and would love to be able to set the PID settings, however they are all doubles and I didn't see anything in the Modbus spec that talked about sending doubles to a device, everything looks like integer values.
Any ideas on the best way to go about setting this up?
Thanks
- Netduino Forums
- → Coding Smackdown's Content
- Privacy Policy