Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: RTC DS-1307 on: April 01, 2014, 06:53:20 am
I've been working with the DS3231 a little bit, which is a newer, pin for pin compatible version of the DS1307.

It doesn't have the same number of pins, and doesn't come in the same packages, therefore I wouldn't call it pin-for-pin compatible.
You are right. Sorry for the misinformation. I edited my original post.
2  Using Arduino / Project Guidance / Re: datalogging strategy on: March 31, 2014, 08:18:35 pm
That's great news, thank you.

I'll dig into the SD Fat library.
3  Using Arduino / Project Guidance / datalogging strategy on: March 31, 2014, 01:06:37 pm
I am re-inventing the wheel by making a datalogger using a Nano, a DS3231 RTC board, and a micro SD card board with on-board voltage level converters.

I was going to buffer a few hundred bytes of data in RAM (if there's that much unused RAM available) before writing it to the SD card. However, after googling/reading about SD card write "wear", I don't know if writing bigger chunks reduces "wear".

Does anybody know which of the 2 methods is best, or know of a better third method?

Method 1:  Open the file, write 100 bytes, close the file.
Method 2: Open the file, write 1 byte, close the file, and do it 100 times.
4  Using Arduino / Project Guidance / Re: RTC DS-1307 on: March 31, 2014, 08:12:21 am
I've been working with the DS3231 a little bit, which is a newer version similar to the DS1307. I understand the internal registers are a bit different between the 2 versions. http://datasheets.maximintegrated.com/en/ds/DS3231.pdf

At least in the 3231, you can set an alarm which can generate an output signal which you can connect to an Arduino. If the Arduino has to act immediately when the time comes, then you could program an interrupt service routine in the sketch and use an interrupt input pin. Otherwise feed a regular digital input pin on the Arduino, and let the sketch loop, reading the input over and over until it changes.

Except for setting the time, alarm(s), and registers in the 1307/3231, you almost don't need the Arduino.
5  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet shield V3 + Mega 2560 HTTP server freezes randomly on: March 29, 2013, 04:52:58 pm
I will work on implementing the fixes.

I was watching the original thread with great interest and wondered if you got this situation worked out.
6  Using Arduino / Displays / Re: how do I "convert" text to ASCII for outputting to a display? on: January 02, 2013, 12:35:43 pm
Both the standard HD44780 LCD displays, and the DL3416 LED displays I'm working with have ASCII to display segment decoders, but that's not what I'm talking about.

So far in my little project, if I want to make the letter A appear on the display, I send the ASCII value 65 - in binary - on a single port that is interfaced in parallel to the display chip. But as I said in my original post, I'm hard coding the ASCII value in the program which is tedious. That's why I started reading the LiquidCrystal library files, because the lcd.print function takes A, and obviously somehow converts it to 65, suitable for outputting the the LCD display.
7  Using Arduino / Displays / Re: how do I "convert" text to ASCII for outputting to a display? on: January 02, 2013, 12:11:16 pm
Quote
I just can't find it in plain text in any of the files I've opened.
That is because it doesn't work like that.

Quote
ind a "table" in a file that has "A" = 65,  "B" = 66,
Just think what "A" or to be more accurate 'A' actually is. It is the bit pattern 0100 0001 or to put it into hex 0x41, or if you put it into decimal, which is just silly as far as a computer is concerned it is 65. So 'A' IS 65 there is no need to have a table that says 65 is 65.

Somewhere down the line 65 corresponds to several bit patterns that make up the letter A when displayed on a dot matrix.
Maybe you will get a better idea if you look up a font generator, like this one:-
http://www.lcddesigner.com/english/overview.html
Normally implemented as a look up table in memory or in a read only memory chip.

I know the ASCII table is well established and that the character 'A' was assigned 65 and that it's gospel. But your last sentence is my point. Atmel microcontroller chips don't have an ASCII table in them, and there are no ROM chips on the Arduino boards that could contain such a table that I know of, so the table must be somewhere in a library header file, cpp file, or some file that (when needed) gets dumped in the flash memory at compile/program time. I started in the LiquidCrystal library, and I thought I opened every single file referenced, then opened every other file referenced in those files, etc., but maybe not. Maybe the ASCII table I'm so dying to see is in some low level binary file and I'll never find a plain text, readable file.
8  Using Arduino / Displays / Re: how do I "convert" text to ASCII for outputting to a display? on: January 02, 2013, 11:19:44 am
The "magic" you are looking for is in the Print class.
If you look at Print.cpp down in
{installdir}/hardware/arduino/cores/arduino
You will see the print() functions.
The Print class functions are inherited by the libraries that use them
like HardwareSerial and LiquidCrystal.
If you look in LiquidCrystal.h
you will see this line:
Code:
class LiquidCrystal : public Print {

That says that all the functions in the Print class will be available to objects
in the LiquidCrystal class.

Then the real magic is the virtual function write().
When using a LiquidCrystal object function like:
Code:
lcd.print("hello");
The Print class function print() is called because it was inherited by LiquidCrystal.
The Print class code eventually calls the function write() in Print.cpp which
really calls the function write() down in the LiquidCrystal code because the write()
function is virtual and is mapped to LiquidCrystal write() function.
That is how the "conversion" is done.
There is no real conversion for text. The Print class pushes out characters one
at a time through the write() function.
For numbers there is a some conversion from numbers into characters that happens then the same
process is used to push out the individual characters.

--- bill

I don't expect you to find it, but I thought I would eventually find a "table" in a file that has "A" = 65,  "B" = 66, etc. I guess it must exist somewhere because there is no algorithm that can magically generate it. After posting about it, thinking, reading, and working on it another 24 hours, it's become apparent it's the only way it can be done. I just can't find it in plain text in any of the files I've opened.
9  Using Arduino / Displays / Re: how do I "convert" text to ASCII for outputting to a display? on: January 02, 2013, 12:09:17 am
They are Siemens DL3416 17 segment, LED alpha numeric displays, that are long out of production.
I have a 1990 Siemens databook that has them, but I didn't find free datasheets on the internet to refer you to.

The timing is not very critical and I can write to them easily, but manually. That's why I was reading the LiquidCrystal library files to see how they did the "text to ASCII conversion". I think I'm making too big of a deal out of this, but I just don't know how it's usually done.  

I will have to write my own routines though since the addressing is done differently than the 44780 LCD displays. These LED displays have the usual write and enable signals, plus a 2 bit chip select and a 2 bit digit select. This addressing scheme allows 4 of the 4 digit displays to be used without external decoder chips.

Thanks for the info on how to do it.
10  Using Arduino / Displays / Re: womarts LCD touch on: January 01, 2013, 11:19:49 pm
I wish these displays http://www.bgmicro.com/color-lcd-screen.aspx and http://www.bgmicro.com/black-and-white-lcd-screen.aspx were Arduino compatible, but they make no such claims. They would be "get what you pay for" like you said. Good luck with the eBay display if you try one.
11  Using Arduino / Displays / how do I "convert" text to ASCII for outputting to a display? on: January 01, 2013, 10:58:16 pm
I'm interfacing a Mega2560 to some alpha numeric LED displays, and I've been writing characters to the displays by hard coding their ASCII values in the program.

I want to write a general purpose function similar to lcd.print, but I'm not sure how to "convert" the text to ASCII. Can I just explicitly define all 64 characters like this?
#define A 65
#define B 66
...

I read through all of the LiquidCrystal .h and .cpp files expecting to see how they did it, but I never did find a table or anything.

What's a good way to do this?
12  Development / Other Software Development / Re: request for correction to documentation on: December 31, 2012, 06:57:12 pm
I never thought about the mapping between the mega2560 chip pins and the Arduino board pins. I was thinking strictly about the port pins on the chip itself.
13  Development / Other Software Development / request for correction to documentation on: December 31, 2012, 05:57:24 pm
On this Arduino web page: http://arduino.cc/en/Reference/BitwiseAnd, about half way down the page you see these two paragraphs.

Example Program
A common job for the bitwise AND and OR operators is what programmers call Read-Modify-Write on a port. On microcontrollers, a port is an 8 bit number that represents something about the condition of the pins. Writing to a port controls all of the pins at once.

PORTD is a built-in constant that refers to the output states of digital pins 0,1,2,3,4,5,6,7. If there is 1 in an bit position, then that pin is HIGH. (The pins already need to be set to outputs with the pinMode() command.) So if we writePORTD = B00110001; we have made pins 2,3 & 7 HIGH. One slight hitch here is that we may also have changeed the state of Pins 0 & 1, which are used by the Arduino for serial communications so we may have interfered with serial communication.



In the second paragraph, this sentence seems wrong: So if we writePORTD = B00110001; we have made pins 2,3 & 7 HIGH. It should say we have made pins 5,4, & 0 HIGH, or else change the binary number to B10001100.
14  Using Arduino / Displays / Re: can you read or write 8 bits at once? on: December 31, 2012, 12:38:28 pm
That's cool, it worked! if you can do that, why would they explicitly define 00000000 - 11111111? That's rhetorical as I don't expect you to defend it.
15  Using Arduino / Displays / Re: can you read or write 8 bits at once? on: December 31, 2012, 12:08:11 pm
I read that all 8 bit binary numbers had been explicitly defined in Arduino and was surprised that they were not "natively" supported in C/C++. But I have a question.  I just tried this: int x = B01001100; and the compiler didn't complain. Then I tried adding 8 more bits and it squawked. I guess that makes sense if only the first 256 binary numbers are defined, but doesn't it take 16 bits to be an integer type? Does this mean you can access only the low byte in an integer using binary?
Pages: [1] 2 3