RE: AW: [avr-gcc-list] Pgmspace.h Use

2005-08-09 Thread Dave Hansen
From: Haase Bjoern (PT-BEU/EMT) * [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, for code portability reasons, I would like to avoid to call explicity the function pgm_read_byte() like in the following example : const prog_char array[7] = {0x10,0x20,0x30,0x40,0x50,0x60,0x70}; y =

Re: [avr-gcc-list] Small program for UART not working

2005-09-12 Thread Dave Hansen
From: Anton Erasmus [EMAIL PROTECTED] [...] I tried to calculate the baud rate on scope, I found I can't get a exactly number, I can only get an estimate. Do you know if there's way to set the baud rate accurately? Send 0xAA continiously. That way you get a nice square wave at the baud rate

Re: [avr-gcc-list] Code version timestamp

2005-09-14 Thread Dave Hansen
From: [EMAIL PROTECTED] (Joerg Wunsch) [EMAIL PROTECTED] wrote: I would like to display a code version (date/time or incremental number) during init on an LCD display. If you're using CVS, you can get the date of the last checkin of a particular module by const char foo[] = $Date$; And

Re: [avr-gcc-list] Code version timestamp

2005-09-14 Thread Dave Hansen
From: Anton Erasmus [EMAIL PROTECTED] On 14 Sep 2005 at 6:21, John Altstadt wrote: [...] %.elf: $(OBJ) @echo @echo $(MSG_LINKING) $@ $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) rm version.o There is a better way to force the recompile of version.c

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-19 Thread Dave Hansen
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

Re: [avr-gcc-list] OT Generic C question

2005-09-20 Thread Dave Hansen
From: David Brown [EMAIL PROTECTED] - Original Message - From: Trampas [EMAIL PROTECTED] I was helping a friend debug some code, he is new to C, using the Keil version of GCC for ARM. Anyway I found the following: int i; i=0; i=i++; //i was still zero that [...] I'd agree with

Re: [avr-gcc-list] Trick for creating WYSIWYG bitmaps in C [was: howto specifiy a binary constant]

2005-09-23 Thread Dave Hansen
From: Bob Paddock [EMAIL PROTECTED] I thought I'd try this bitmap 'trick' via copypaste of the #defines and code into the file I was working on, this is what I get: Name/name.c:692: error: `sXX__' undeclared here (not in a function) Name/name.c:692: error: initializer element is not

RE: [avr-gcc-list] Lint and avr-gcc

2005-09-26 Thread Dave Hansen
From: Jonathan Goldberg [EMAIL PROTECTED] Anyone have a good lint configuration file for avr-gcc? You don't say which lint. Here's the one I'm using for a current project under Ginpel's PC-lint. --- begin included file --- // Compiler definitions // c:\lint\lnt\co-gnu3.lnt // 2.95.3

RE: [avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Dave Hansen
From: Vincent Trouilliez [EMAIL PROTECTED] [...] Problem: my function pointers are in an array, within a structure, which itself is accessed via pointers... oh dear. [...] //data type for a menu struct menu { .; .; int (*fp)()[]; //table to store all the

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Dave Hansen
From: Vincent Trouilliez [EMAIL PROTECTED] [...] However, something still causes me trouble apparently The actual/complete declaration of my menu data type / structure is : struct menu { uint8_t options; //options to control the operation of the menu uint8_t nb;

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-29 Thread Dave Hansen
From: Vincent Trouilliez [EMAIL PROTECTED] [...] What more could I possibly want ? Well, there is one thing actually: the pointer points to a function, any function. However if the item is actually a sub-menu, then the 'menu_item' structure needs to store a pointer to a 'menu' structure, so that

RE: [avr-gcc-list] CVS or SVN ?!

2005-09-30 Thread Dave Hansen
From: Vincent Trouilliez [EMAIL PROTECTED] Hi list, I have been advised to use CVS when developing programs, but it seems awkward to set up the server side. While asking around for help, I have been suggested to give up CVS and use SVN, subversion, instead, and that it was meant to supplant

Re: [avr-gcc-list] Compile problem

2005-10-07 Thread Dave Hansen
From: Patrick Blanchard [EMAIL PROTECTED] On Fri, 2005-10-07 at 08:24 -0700, Razvan Turiac wrote: I think I have a compile problem. I am using WinAVR 20050214 and I've got one problem when compiling some code. OK, but you need to show us the compiler errors received... You have to scan

Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege

2005-11-04 Thread Dave Hansen
From: David Brown [EMAIL PROTECTED] [...] The bug is almost certainly a delay loop variable that is not declared volatile. The delay function is probably something like: void shortDelay(void) { uint8_t n = 50; while (n--); } That (might) work fine with little or no optomisation, but

Re: [avr-gcc-list] How to (efficeiently !!!) testabitwithinamulti-byte intege

2005-11-07 Thread Dave Hansen
From: Vincent Trouilliez [EMAIL PROTECTED] FWIW, I always had good luck with the delay functions in delay.h for short hardcoded (usec) delays. Lucky you ! Other than wanting to avoid all this in-line stuff, the reason I replaced _delay_us(40) in my lcd routine, by an empty for loop, is

Re: [avr-gcc-list] AVR assembly for fast bit bang

2005-11-09 Thread Dave Hansen
From: David Kelly [EMAIL PROTECTED] [...] People keep saying C isn't fast enough. I don't belive it. First attempt: #include avr/io.h #define CLOCK_B (10) #define BIT_B (11) void myjunk(uint8_t byte) { uint8_t i; for( i = 0 ; i 8 ; i++ ) { PORTA |= CLOCK_B;

RE: [avr-gcc-list] sdram adress/length

2005-11-10 Thread Dave Hansen
From: varsha [EMAIL PROTECTED] hello all, i am using avr-gcc (GCC) 3.4.3, and using ATmega16 , and writng the code for copying sdram data int flash, in c language. There are three address bytes and three length bytes for sdram. At a time i can read 16 bytes from sdram, then i want to decerment

RE: [avr-gcc-list] Problem with debbuggin with AVRStudio, WinAvr and JtagIce mkII

2005-11-16 Thread Dave Hansen
From: [EMAIL PROTECTED] [...] #include avr/io.h int somma(int a, int b) { return a+b; } int main () { int e = 10; int r = 1; r = somma(e,r); r=r+1; return r; } it's a stupid program.

RE: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread Dave Hansen
From: bolet (sent by Nabble.com) [EMAIL PROTECTED] [...] The program works OK without optimization. It doesn't work with optimization (-o1). The code is: ...includes... const char P_Txt[] PROGMEM = Just a test..; volatile PGM_P txt= P_Txt; int main (void) { ...Init code ... (reg setup

RE: [avr-gcc-list] (no subject)

2006-01-30 Thread Dave Hansen
From: MuRaT KaRaDeNiZ [EMAIL PROTECTED] So U08 RX485_oldbyte1; is uninitialized data, but compiler also initialize it to zero, why is it different from inline initialization during declaration, I expect the compiler just replace the zero with the initial value i provide? Because reality is

RE: [avr-gcc-list] query please help

2006-03-07 Thread Dave Hansen
From: rajeev joshi [EMAIL PROTECTED] [...] 4.While working on windows which compiler, simulator shpuld use ,right now i m having codevision AVR ,AVR studio . 5. But i m not gettin how to work on WINAVR . What is your goal? If you have to get a project out, and you have a paid license for

Re: [avr-gcc-list] volatile...

2006-12-15 Thread Dave Hansen
From: Paulo Marques [EMAIL PROTECTED] Graham Davies wrote: David Brown wrote: You are missing a number of points ... Well, I think we're getting close to complete coverage now! Well, since we are going for complete coverage, I'll add my 2 cents, then. You've opened some new cans of

Re: [avr-gcc-list] volatile...

2006-12-15 Thread Dave Hansen
From: Paulo Marques [EMAIL PROTECTED] Dave Hansen wrote: [...] You've opened some new cans of worms here, but I'll only make one small comment I was afraid of that (the cans of worms, not your comment) ;) Thanks for noticing the implied smiley. Looking at what I wrote, I'm not sure

Re: [avr-gcc-list] Should this code work? 4.1.1

2007-03-05 Thread Dave Hansen
From: Graham Davies [EMAIL PROTECTED] Bob Paddock wrote: [...] I don't see while(true){} being any different than for(;;){} in this context, and while(true){} causes the Lint error of evaluation of constant value boolean. [...] I can't see why Lint would consider this an error and for ( ; ;

RE: [avr-gcc-list] Inconsisten behaviour of switch statement

2007-03-26 Thread Dave Hansen
From: Eric Weddington [EMAIL PROTECTED] From: Schwichtenberg, Knut [mailto:[EMAIL PROTECTED] [...] Eric, the point is not that I don't like the output, but the case to be selected should be deterministic. I always thought that a switch statement would lead to identical results if the

Re: [avr-gcc-list] New GCC warning - how to silence?

2007-04-09 Thread Dave Hansen
From: Bob Paddock [EMAIL PROTECTED] [...] What I've never understood at all is why are characters signed in any case?What exactly is the meaning of a negative-letter-A? It's all hysterical raisins. The earliest C compilers made char signed by default because ASCII only requires 7 bits,

Re: [avr-gcc-list] Operation problem

2007-08-11 Thread Dave Hansen
From: Gerard Marull Paretas [EMAIL PROTECTED] Paulo Marques: I think you just answered your own question: if all the variables involved are uint16_t, then that is the precision used for all he expression and it will overflow on the multiplication. The same happens whether if

Re: [avr-gcc-list] avr-g++ local variable constructor / block body/destructor ex

2007-09-06 Thread Dave Hansen
From: Graham Davies [EMAIL PROTECTED] David Brown wrote: I believe [the compiler] can [change order of ... volatile objects access]. Obviously it is only legal if such moves do not affect the volatile accesses themselves. Perhaps someone here who has a better knowledge of the standards

RE: [avr-gcc-list] Problem with delay loop

2007-09-28 Thread Dave Hansen
Date: Fri, 28 Sep 2007 14:21:38 +0530 To: [EMAIL PROTECTED] Subject: Re: [avr-gcc-list] Problem with delay loop From: [EMAIL PROTECTED] CC: AVR-GCC-list@nongnu.org Hi, On Fri, 28 Sep 2007 13:42:18 +0530, Klaus Rudolph [EMAIL PROTECTED] wrote: The code has been optimized. Well done!

RE: [avr-gcc-list] Problem with delay loop

2007-10-02 Thread Dave Hansen
From: [EMAIL PROTECTED] Hi, On Mon, 01 Oct 2007 13:02:32 +0530, David Brown [EMAIL PROTECTED] wrote: Royce Pereira wrote: So I have to write more 'C' code :) to get the same stuff done, in the 'new smarter' compiler! Interesting. Doesn't seem right, some how. Regards,

RE: [avr-gcc-list] ATMega32 fuse bit problem

2007-11-13 Thread Dave Hansen
From: [EMAIL PROTECTED] For instance I recovered chips sometimes by using UART traffic because I had no other hardware at hand: I took a RS232-UART converter, sent a big file from a terminal emulator (with no particular protocol, just raw byte sending) and I tried a few times to

RE: [avr-gcc-list] Tip: handling volatile operands

2008-01-11 Thread Dave Hansen
From: [EMAIL PROTECTED] The point I was trying to make (poorly) was that io (and other variables) that may universally declared volatile, may in fact have values that need to be used in a non-volatile fashion. You have same problem with unrollable operations such as: if (ioport

RE: [avr-gcc-list] 24 bit Integer

2008-07-30 Thread Dave Hansen
From: [EMAIL PROTECTED] 2008/7/14 Weddington, Eric [EMAIL PROTECTED]: A 24-bit integer is not supported by the C language. In theory, support could be added to GCC, but then it would be considered an extension to the C language. And it would also be difficult and/or time-consuming to

RE: [avr-gcc-list] 24 bit Integer

2008-07-30 Thread Dave Hansen
For a PDP-8, CHAR_BIT would be 12, int could have 24 bits, and long could have 36 or 48, whatever is most convenient/efficient/desired. For a PDP-15, char and int could be the same 18-bit type, and long could be 36 bits. On further reflection, you might be able to replace the standard 16

Slightly OT: AVR EEPROM Location 0 (was RE: [avr-gcc-list] address@hidden ... what is it for ?!)

2009-01-06 Thread Dave Hansen
From: dke...@hiwaay.net[...] Notice the starting address of eeprom is 1 byte above the physical address of start of eeprom because there was some rumor stating some models of AVR would accidentally trash the first byte under some circumstances. Perhaps when the rest of the device was wiped

RE: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?

2009-02-05 Thread Dave Hansen
From: dke...@hiwaay.net On Thu, Feb 05, 2009 at 12:13:37AM -0700, Chris Kuethe wrote: On Thu, Feb 5, 2009 at 12:10 AM, Schwichtenberg, Knut wrote: As far as I know hex values won't work as expected but octal does! I used: static char s46[] __attribute__ ((progmem)) = Hei\342gas; /* 46

RE: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?

2009-02-05 Thread Dave Hansen
From: vincent.trouill...@modulonet.fr [...] ISO C99, section 6.4.4.4, p3: the question-mark ?, [..] is representable according to the following table of escape sequences: question mark? \? Interesting. I wonder why the standard deeemd it necessary to provide an escape sequence for the

RE: [avr-gcc-list] memcpy() : problem when passing destination pointer

2009-02-11 Thread Dave Hansen
From: bernard.fou...@kuantic.com [...re: volatile use cases...] fourth case: nasty situations where 'volatile' is only a part of the solution but does not insure a correct result: For instance if ISR1 and ISR2 are *nested* ISRs, IsrCounter does not correctly hold the count of

RE: [avr-gcc-list] Re: Wierd Calls.

2009-03-11 Thread Dave Hansen
From: d...@mobilefusioninc.com [...] I'm still puzzled as to why the compiler didn't change: // This takes 53uS at 4 MHz Bin = ( A / Data_Divisor ) // Data_Divisor is a constant, 32. into // This takes 8.9uS at 4 MHz Bin = ( A 5) Just guessing, but it may be trying to preserve

RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts

2009-03-30 Thread Dave Hansen
From: david.br...@hesbynett.no [...char vs. signed cahr vs. unsigned char...] Don't look it up - if you learn the compiler's default behaviour, you risk writing incorrect code. If it is in any way relevant whether a char is signed or not, write signed char or unsigned char explicitly

RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts

2009-03-30 Thread Dave Hansen
From: j...@uriah.heep.sax.de Dave Hansen i...@hotmail.com wrote: In this code=2C the handle_input function falls into an infinite loop if pl= ain char is signed. This is because key gets promoted (to signed int) befo= re the comparison with EXIT_KEY (which is already signed int

RE: [avr-gcc-list] Re: Passing a string variable to lcd_puts

2009-03-30 Thread Dave Hansen
From: i...@hotmail.com That would work. Another way is to have get_key return int. Oops. I mean, of course, make key an int. Having get_key return an int that is then stored into a char would accomplish... nothing. Regards, -=Dave Express your personality in color!

RE: [avr-gcc-list] Rounded integral division in preprocessor

2010-02-05 Thread Dave Hansen
From: jb@gmx.de: I'm trying to do rounded (opposed to truncated) integer division with avr-gcc with using only preprocessor magic. This proves to be difficult: The current code I'm using is #define __IDIV(x, y) (long)(((long)x + ((long)y / 2L)) / (long)y) #define IDIV(x, y)

Re: [avr-gcc-list] Can enumerator values be used in a #if preprocessordirective?

2011-08-29 Thread Dave Hansen
From: graceindustr...@gmail.com [...] So that explains the difference. Seems like there could be a better error message for this case, 'don't use enum here', alas The preprocessor does not know anything about types in the language... Here's a cute/ugly little macro that might help you

Re: Saving & retreiving a structure in eeprom

2020-06-09 Thread Dave Hansen
You wrote >>> eeprom_read_block((void *), (const void *)eepLoc, num) ; What is num? -=Dave From: AVR-GCC-list on behalf of Royce Pereira Sent: Tuesday, June 9, 2020 8:18 AM To: avr-gcc-list@nongnu.org Subject: Saving & retreiving a structure in eeprom