[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Program Space String Utility - winavr20030312
From: |
E. Weddington |
Subject: |
Re: [avr-gcc-list] Program Space String Utility - winavr20030312 |
Date: |
Thu, 10 Apr 2003 10:02:56 -0600 |
On 10 Apr 2003 at 11:45, Loc Mai wrote:
> Why does sizeof(leds) work, but not strlen(leds) in for loop
> 1. for (l=0; l<sizeof(leds); l++) { //works fine
>
> 2. // for (l=0; l< strlen_P(leds); l++) { does not work properly,
> never get 0xFF from array.
>
> Anyone knows where I can get examples how I can use Program Space
> String Utility - winavr20030312. In the AVR-libc reference does not
> show how the can be applied. It is not easy to understand for newbie
> like me. Cheers.
>
> Here is program:
> #include <inttypes.h> //-------
> #include <avr/io.h>
> #include <avr/pgmspace.h>
>
> static uint8_t PROGMEM array[]={0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0,
> 0x80, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
>
> int main(void)
> {
> uint8_t i, j, k, l, n=0;
> // uint8_t i, j, k, l;
>
> outp(0xff,DDRB); /* use all pins on PortB for
> output */
> for (;;) {
> for (l=0; l<sizeof(leds); l++) { //works fine
> // for (l=0; l< strlen_P(leds); l++) {
> outp(PRG_RDB(&leds[l]), PORTB);
>
> //delay ....cut here ................
> //..........................................
> }
> }
> }
Where is leds declared? What is leds?
Eric