Pages: [1]   Go Down
Author Topic: Sparkfun SerLCD + Arduino FIO = problems  (Read 935 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I recently purchased a 3V sparkfun LCD + serlcd. I tested it with my Arduino Duemilanove and it worked fine. I had a simple program just output "hello world" using SoftwareSerial to pin 13.

Then I decided to try my Arduino FIO. Same code and it returns random characters.

I'm not sure what's going on. If it works on the Duemilanove shouldn't it work on the FIO? I use the 3V3 pin on both for power. The LCD powers up just fine on both Arduinos.

Any ideas what I'm doing wrong?

Thank you!
Felix
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The Arduino Fio is a microcontroller board based on the ATmega328P (datasheet) runs at 3.3V and 8 MHz.

...

Quote
The Arduino Duemilanove ("2009") is a microcontroller board based on the ATmega168 (datasheet) or ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator,

The Fio runs at half the clock speed so your baud rate is out by a factor of two.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Nick!

Is there anything I can do programmatically to make the LCD display work with the Fio even if it's operating at 8MHz?

Thanks again,
Felix
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I had a simple program just output "hello world" using SoftwareSerial to pin 13.

Perhaps if you show this simple program.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure thing...

Code:
#include <SoftwareSerial.h>

#define txPin 13

SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10;  // conservative, 2 actually works

// wbp: goto with row & column
void lcdPosition(int row, int col) {
  LCD.write(0xFE);   //command flag
  LCD.write((col + row*64 + 128));    //position
  delay(LCDdelay);
}
void clearLCD(){
  LCD.write(0xFE);   //command flag
  LCD.write(0x01);   //clear command.
  delay(LCDdelay);
}
void backlightOn() {  //turns on the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(157);    //light level.
  delay(LCDdelay);
}
void backlightOff(){  //turns off the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(128);     //light level for off.
   delay(LCDdelay);
}
void serCommand(){   //a general function to call the command flag for issuing all other commands   
  LCD.write(0xFE);
}

void setup()
{
  pinMode(txPin, OUTPUT);
  LCD.begin(9600);
  clearLCD();
  lcdPosition(0,0);
  LCD.print("Hello world!");
}

void loop()
{
}
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And the datasheet for the LCD display:

http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Since you are running at half speed, double the baud rate:

Code:
void setup()
{
  pinMode(txPin, OUTPUT);
  LCD.begin(19200);   // actually 9600 if we were running at 16 MHz
  clearLCD();
  lcdPosition(0,0);
  LCD.print("Hello world!");
}
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Nick. That worked.

Much Appreciated!

Felix
Logged

Pages: [1]   Go Up
Jump to: