Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Note about pin 13 and digital input on: May 06, 2007, 10:24:29 pm
Hi all,

I just spent two hours figuring out what was causing me trouble, and am posting here so that I can hopefully save someone else some time.

I'm trying to read a 9 bits (8 bit data byte, plus one "data good" signal) in parallel into my Arduino. I am using three digital inputs, (11, 12, and 13) and the analog inputs. My reason for using the analog inputs is to save the digital outputs to drive a pair of shift registers (4 pins each, 1 shared, so 9 total).

When reading the input byte, I noticed that I didn't always get the correct value. At first, I assumed an error in the algorithm that generates the number, but when that checked out, I started getting suspicious of the part that sends the 9 bits to the Arduino. I had it send values that would have a lot of the data bits set, such as 255 (11111111 in binary). It appeared that no matter what I sent, the second bit from the MSB was always 0. I checked which pin that was, and noticed that it was pin 13, the pin with the LED on it.

Looking at the schmatic, I noticed that the LED is between the pin and ground. At 5V, LEDs don't present a lot of resistance. I effectively had a 0 ohm pulldown resistor on the input, keeping it at ground no matter what signal I applied to it. Interestingly, on the NG Rev C boards, the LED is not installed. I have my suspicions that this is because it makes the pin hard to use as an input.

My plan now is to take the LED off so I can use the pin. I'll leave the SMD resistors next to it in place, so that I can still use an LED between 13 and ground for debugging.

Hope this saves someone's evening,
Abend


http://www.arduino.cc/en/uploads/Main/arduino_NG_schematic.png

2  Forum 2005-2010 (read only) / Interfacing / Re: 4 bit LCD connection only uses half of LCD on: February 01, 2007, 08:57:39 pm
I have it figured out. The LCD is 16x1 physically, but it is 2x40 logically. If I write a message that is greater than 40 characters, the part beyond 40 characters appears on the second set of 8 character spaces.

As a result, the way to get a message onto the display is to break it into two 8-character parts, put the cursor at the first character of the first line, print the first part of the message, move the cursor to the second line, and print the second part of the message.

The code I used for this is below.

Interestingly, since there are 2 lines of 40 chars, and the LCD only uses 8 on each line, there are 64 characters that are not visible. These are probably good for buffering for scrolling, or just as off-chip storage. You would have to be able to read from the LCD to use it as off-chip RAM.

Code:
void setup()
{
  LCD4Bit lcd = LCD4Bit(2);   //It's 2-line internally
  lcd.init();
  delay(50);
  lcd.clear();
  delay(50);
  lcd.cursorTo(1,0);        //Home on first line
  delay(50);
  lcd.printIn("hello wo");  //First part of message
  delay(50);                
  lcd.cursorTo(2,0);        //Home on second line
  delay(50);
  lcd.printIn("rld! foo");  //Second part of message
  delay(50);
}
3  Forum 2005-2010 (read only) / Interfacing / 4 bit LCD connection only uses half of LCD on: January 31, 2007, 11:04:20 pm
Hello,

I am using neillzero's 4-bit LCD library with a 16x1 character LCD. After a little initial confusion with which wires went were, I am now able to write to the LCD.

However, only the first 8 character spaces are used. The second 8 are left blank, and my "hello world" is truncated to "hello wo". If I do an lcd.commandWrite(0x1C), everything shifts right, but it drops the last character, rather than shifting it into the 9th character space.

I have tried with 3 different LCDs of the same size, and they all exibit the same problem.  

I suspect that I am either not initializing the LCD correctly, or I need to set a configuration setting that I've missed, but I don't know what it is.

If anyone else has seen this, or has any idea how to fix it, please let me know.


My program :
Code:
#include <LCD4Bit.h>

void setup()
{
  LCD4Bit lcd = LCD4Bit(1);
  lcd.init();
  delay(500);
  lcd.clear();
  delay(500);
  lcd.printIn("hello world");
  delay(500);
  lcd.commandWrite(0x1c);
  delay(500);
}

void loop()
{
}
Pages: [1]