Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Troubleshooting / Re: "L" light flashes, program restarts on: September 28, 2009, 01:57:19 pm
upon further investigation, i've discovered a few things.
if i say
d1.print((long) d1.getCursor());
i don't have a problem.
getCursor() returns an int.
according to Print.cpp, the included Arduino library, when print receives and int it does the following
void Print::print (int n)
{
 print ((long) n);
}

any idea why it works when i explicitly tell it to (long).  shouldn't print be able to handle this?

also, if i tell it to
d1.print("01234567")
i get a garbage character instead of the 7
but if explicitly send each character to write
d1.write('0');
d1.write('1);
etc
the 7 comes out fine.

as i understand print();  if you send a string, it basically just parses the string and sends each character to write();
any idea why print(); would fail, but sending each character to write() explicitly would work?
2  Forum 2005-2010 (read only) / Troubleshooting / Re: "L" light flashes, program restarts on: September 28, 2009, 12:57:42 pm
Code:

#include <LedDisplay.h>



// Define pins for the LED display.



#define dataPin 6              // connects to the display's data in

#define registerSelect 7       // the display's register select pin

#define clockPin 8             // the display's clock pin

#define enable 9               // the display's chip enable pin

#define reset 10               // the display's reset pin



#define displayLength 8        // number of characters in the display



// create an instance of the LED display library:

LedDisplay d1 = LedDisplay(dataPin, registerSelect, clockPin,

enable, reset, displayLength);



int brightness = 15;        // screen brightness



void setup() {

  

  // initialize the display library:

  d1.begin();

 

  // set the brightness of the display:

  d1.setBrightness(brightness);

 

}



void loop() {



//set cursor to 0 position

  d1.home();



//print cursor position in each respective position    

  for (int i = 0; i < 8; i++){

   d1.print(d1.getCursor());

   delay(500);

  }



//clear display

  d1.clear();  

 

}

there is no direct manipulation of pin 13.
this program is using the LedDisplay library to talk to an HCMS-2915 8 character led display.
ideally the program would write to the display, one character at a time
01234567
then clear, and begin writing again.
when it gets to 6, the pin 13 LED (or L light as I confusingly called it) blinks, and the program restarts, clearing the display, and starting from 0.
i'm externally powering the display, and I'm running the arduino off of the USB power.
3  Forum 2005-2010 (read only) / Troubleshooting / "L" light flashes, program restarts on: September 25, 2009, 01:59:22 pm
I'm running a program interfacing with an LED display.  I have a simple script running in void loop() that just continually spits out numbers.  After only 7 iterations or so, the "L" light blinks, and the board restarts.

I realize I'm being vague, and I can get more specific as necessary, but generally what causes the board to up and restart?
4  Forum 2005-2010 (read only) / Syntax & Programs / calculating check sum on: January 05, 2011, 04:24:00 pm
I'm sending serial packets to control a motor driver.  Each packet needs the final byte to be a check sum.  When all bytes and the check sum value are added together, the hex number ends in 00.  I need my program to calculate these check sums.

a packet is an array that looks like this
int packet[] = {0x00, 0x10, 0x00, 0x86, 0x6A};
in the example, 6A is the checksum. (10 + 86 + 6A = 100)

if i change the values of the packet, I need to calculate a correct checksum.  
here is my example code, with a line of imaginary code doing the part i don't know how to do
Code:
//takes as input a packet whose check sum needs to be recalculated
//and the size of the packet in bytes

int* calcCheckSum (int* pack, int packSize) {
  int sum = 0;
  for (int i=0; i < (packSize-1); i++) {
       sum = pack[i] + sum;
       }
  sum = last two digits of sum in hex;
  pack[packSize-1] = 100 - sum;
  return pack;
}
   
5  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: December 04, 2009, 09:40:13 am
The print() thing is weird.  From what I can tell, it's just recursive calls to write(), which should work fine.  Apparently there's something funny going on with the way it handles the last call in the chain, though.  Hopefully more clever folks than I will crack it.
Speaking of, if you get a modification to the library working for multiple displays, please post it in the playground.  I tried and failed, but the workaround is not too bad.
6  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: November 30, 2009, 09:10:59 am
i banged my head against this for quite some time.  i even talked a bit with tom igoe who wrote the ledlibrary.  he had the same problems.  he advised me to use another method, and i advise you as well.  they don't daisy chain as simply as the data sheet suggests.  there's some bit of information that they don't provide.  just common all the lines with a unique CE pin for each display, and you should be able to do pretty much the same stuff (albeit with clunkier code).  que sera.
7  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: November 12, 2009, 02:55:12 pm
if it works, it's a good way.  at least it's better than the other way.
i used write also.  it's clunky, but i couldn't make print() work.  
8  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: November 11, 2009, 02:51:45 pm
don't use print()
it doesn't work right.
9  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: November 10, 2009, 03:33:23 pm
Look at the included font library to see how the characters are mapped.
Each of the 5 columns that make up each character are represented by a hex word.  The hex word when looked at in binary tells you which of the 7 dots in the column are on or off.  (one digit of the 8 digit binary word is ignored, but i don't remember if it's the first or last).
so each character is made with 5 hex words.
if you pick a character from the font library, and write out the 5 hex words in binary, you'll learn exactly how they're mapped out.  
draw your characters in a 5x7 grid, then translate your binary columns to hex, and you'll have custom maps for your custom characters.  this is as far as i can take you.
10  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: November 09, 2009, 08:38:17 am
The displays can show any character you can create out of the 5x7 bitmap, but you'll have to create your own hex map for the special characters if you want to use the LedDisplay library to display them.
(these special characters might be included in the packaged font library, but i doubt it)
11  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: September 25, 2009, 09:49:46 am
Aha!
the begin(); function is what was screwing me up.
when i called
myDisplay1..begin();
everything worked fine.
but as soon as i called
myDisplay2.begin();
the reset pin was toggled again, and because they're all bussed, it wiped out the first display that I initialized.
I called all the functions inside of begin(); explicitly, only calling the reset once, and it's working great.

I'd still love to figure out how to daisy chain, but for now having a workable solution is great.
12  Forum 2005-2010 (read only) / Interfacing / Re: multiple HCMS-2915 displays on: September 25, 2009, 08:54:21 am
Thanks so much for the reply.
Here is a link to the date sheet .pdf
http://www-mtl.mit.edu/Courses/6.111/labkit/datasheets/HCMS-2973.pdf

According to the data sheet, it seems like all I need to do is parallel all connections except data, then link data out to data in from right to left, and I can write to multiple displays as if they are one long display.  The LedDisplay library assumes a bit register of 320, which is the size of an 8 character display.  I've altered the source to make it 640 and tried writing to two displays with no luck.  (I also doubled the size of the array that holds the bit register data, as well as the displayLength parameter in my program.)

It looks like you paralleled the data, then switched the chipEnable pins if I understand your diagram.  That seems like a clever workaround I'm eager to try, but I can't get over that it seems like it should be easy to write as if I have one long display.
13  Forum 2005-2010 (read only) / Interfacing / multiple HCMS-2915 displays on: September 21, 2009, 03:21:50 pm
I've got one HCMS-2915 (8 character) working like a champ with the LedDisplay library.  Has anyone had luck with stringing multiple displays together?  I would ideally like to string 5 together to have a 40 character display.  I can pull it off with a mega, giving every display it's own 5 digital pins, but I believe these displays are designed to daisy chain their data to act like larger displays.  I've tried paralleling all pins except data, then chaining data in to data out, but I haven't had any luck.  
14  Forum 2005-2010 (read only) / Interfacing / Libelium MicroSD Module to ICSP header on: September 29, 2009, 01:53:59 pm
If I connect the Micro SD card to the ICSP header, do I have full use of all of the digital pins for other functions?  I'm afraid the ICSP header may be hard wired to some of the digital pins.  

product in question
http://www.libelium.com/tienda/catalog/product_info.php?products_id=66

15  Forum 2005-2010 (read only) / Interfacing / RS485 in and out on: May 05, 2009, 10:08:38 am
I'm new to the Arduino and I'm trying to get my bearings. I've purchased a couple Duemilanoves and I'd like to send RS485 in, use the Arduino to interpret the signal, and send either 485 or RS232 out.  I've read that the Arduino can not take 485 in natively and have seen some info about using a MAX485 to alter the signal.  
What I can't understand is what the MAX485 is putting out that the Arduino can interpret.  Is it converting to RS232, or just altering the bias of the 485?
What is the native communication protocall the Arduino supports, or does it depend on what libraries or code you install on it?
How many serial ins or outs can the Duemilanove support?
Sorry if this is basic info and covered somewhere else, but I haven't been able to find it.
Pages: [1] 2