On Tue, 2005-09-20 at 00:56 -0500, David Kelly wrote:
I prefer to read the busy flag in bit 7 of register 0 on the LCD
rather than timed loops. Text LCDs are fairly predictable but I'm
more comfortable delaying my next write until the particular LCD says
its ready. Some LCD commands take
On Sep 18, 2005, at 11:11 PM, Vincent Trouilliez wrote:
Okay, I got your dot_two() working (the another_dot_two() has one last
fatal error that I can't figure out yet).
Yeah well, still not bad for code written in bed on laptop in the
email editor.
I tested it in all fairness. That is,
From: David Kelly [EMAIL PROTECTED]
[...]
char buffer[4];
uint8_t i;
strncpy_P( buffer, PGM_P(000), 3 );
i = 2;
while(x) {
buffer[i--] = x%10 + '0';
x = x/10;
}
putchar(buffer[0]);
putchar('.');
putchar(buffer[1]);
putchar(buffer[2]);
In
- Original Message -
From: Dave Hansen [EMAIL PROTECTED]
From: David Kelly [EMAIL PROTECTED]
[...]
char buffer[4];
uint8_t i;
strncpy_P( buffer, PGM_P(000), 3 );
i = 2;
while(x) {
buffer[i--] = x%10 + '0';
x = x/10;
}
On Monday 19 Sep 2005 17:11, David Brown wrote:
...
Nice code.
My other solution would be to put the powers of ten in an array and
compare them instead of doing the division, but I think your code will
probably be faster.
It might be possible to merge the two methods and put your bit patterns
On Mon, Sep 19, 2005 at 05:46:52PM +0200, Vincent Trouilliez wrote:
On Mon, 2005-09-19 at 07:33 -0500, David Kelly wrote:
Your putchar() (or whatever) writes to an LCD? So how long does it
take to latch a character into the LCD?
Yep I print to standard text LCD module (4x20), it takes about
On Mon, Sep 19, 2005 at 10:19:41AM -0400, Dave Hansen wrote:
Try something like
#include stdlib.h
...
div_t qr;
while(x) {
qr = div(x,10);
buffer[i--] = qr.rem + '0';
x = qr.quot;
}
I'm not certain this is optimal. I haven't looked closely, but it
looks
On Mon, 2005-09-19 at 20:22 -0500, David Kelly wrote:
OK, 0.2ms max to write one, but how long to write two? Once the data is
latched into the LCD it has to process and IIRC that is often 1 ms.
No, as I said it takes only 40us for the LCD to process a character.
You send a character to it,
Thanks Jesper and Yann ! :-)
So far I had the clear idea that a header file should not contain any C
statement that yields to executable code, and that such code should be
in the source file. But I wasn't sure about constants, since they don't
produce any code. But, they nonetheless occupy code
On 18 Sep 2005 at 19:55, Vincent Trouilliez wrote:
Thanks guys for the help,
I appear to have one last little problem about this :
if I do as David did, that is declare my array in main.c, then it
works fine. If I declare the array in ui.h (ui stands for User
Interface in my case),
Vincent Trouilliez wrote:
Now I am having problems using printf with my strings...
if I do : printf(blah blah) it works perfectly, but if I try to use
the array of strings I just defined as constants in ui.c, well it
doesn't work quite as well sadly...
for example :
void main(void)
{
On Sep 18, 2005, at 3:02 PM, Vincent Trouilliez wrote:
Do I need to use some variant of the printf function when displaying
data declared with the __ATTR_PROGMEM__ attribute ?
Yes. printf_P(). Better read the manual as I don't use printf() so I
haven't used printf_P() and can't say how or
Thanks chaps, printf_P and printf(%S, ) do the trick.
If I may ask one more question before, I happen to have a problem define
one of the units : °C.
This '°' degree sign is not ASCII but extended ASCII, and my LCD module
has a japanese (!) page code for extended characters.
So I need to
On Sun, 2005-09-18 at 16:54 -0500, David Kelly wrote:
...I don't use printf() so I haven't used printf_P()
But how do you do then ?
Well, now I think of it, there is at least one case where I won't be
able to use printf, well I think.
printf_P() is nice to printf my strings easily from
On Mon, 2005-09-19 at 00:33 +0100, Richard Urwin wrote:
Try
{ ... , {\xDF C }, ... },
I used two concatonated strings because otherwise the C will be taken as
part of the hex sequence.
This works like a charm, thanks very much Rich ! :-)
This list is very efficient and responsive, a
Richard Urwin wrote:
On Sunday 18 Sep 2005 23:33, Vincent Trouilliez wrote:
const struct param __ATTR_PROGMEM__ param_list[] = {
{ ... , {0xDF, C }, ... },
...
};
Try { ... , {\xDF C }, ... },
I used two concatonated strings because otherwise the C will be taken
as part of
On Monday 19 Sep 2005 00:12, Vincent Trouilliez wrote:
On Sun, 2005-09-18 at 16:54 -0500, David Kelly wrote:
...I don't use printf() so I haven't used printf_P()
But how do you do then ?
Well, now I think of it, there is at least one case where I won't be
able to use printf, well I
2) A slight modification of Richard's idea would be to use the octal
code equivalent to 0xDF. Since you can escape octal values and get the
equivalent ascii value.
{ ... , {\337C }, ... },
The nice thing here is that it becomes a single string.
HTH,
Chris
THAT, is exactly what I
The only alternative is:
printf (%d.%03d, x / 1000, x % 1000)
I don't know the capabilities of avr libc, I hope it copes with the
leading zero format.
Just tested it...
int main (void){
unsigned int value;
value = 6874;
while (TRUE) {
lcd_goto_rc(1,1);
On Sep 18, 2005, at 5:33 PM, Vincent Trouilliez wrote:
On Sun, 2005-09-18 at 16:54 -0500, David Kelly wrote:
...I don't use printf() so I haven't used printf_P()
But how do you do then ?
If you wrote better functions, please share ! :-)
Printf takes huge space, so if you have a light
20 matches
Mail list logo