avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] RE: [AVR club] STK500 Demo file rewritten in C, almost c


From: Dave Hylands
Subject: [avr-gcc-list] RE: [AVR club] STK500 Demo file rewritten in C, almost completed!!!
Date: Mon, 19 Jan 2004 21:49:54 -0800

The ASM sample msu be doing a rotate, rather than a shift (the AVR may
use slightly different terminology - I'm more familiar with 68k
assembler). To do the same thing in C, you need to manually do the
rotate, unless you're going to use inline assembler.

Performing the operation manually would enatail something like the
following:

        if (( var & 0x80 ) != 0 )
        {
                var <<= 1;
                var |= 1;
        }
        else
        {
                var <<= 1;
        }

In the opposite direction:

        if (( var & 1 ) != 0 )
        {
                var >>= 1;
                var |= 0x80;
        }
        else
        {
                var >>= 1;
        }

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/


> -----Original Message-----
> From: Steven Chang-Lin Yu [mailto:address@hidden 
> Sent: Monday, January 19, 2004 9:27 PM
> To: 'AVR-GCC'; 'AVR-Chat'; 'AVRCLUB'
> Subject: [AVR club] STK500 Demo file rewritten in C, almost 
> completed!!!
> 
> 
> Guys, I have almost complete the file of the STK500 demo file 
> shows in the manual of the STK500 and preload on the 8515 
> came with the STK500.  The only problem now is the two shift 
> right and shift left function!!!
> 
>  
> 
> With the original asm demo, the shift left and shift right 
> shift the entire data in the temp registry, and do it as a 
> loop!!!  However by using the >>= or <<= in C, once all the 
> package have been shifted to the end, only one led is 
> continue in the loop rather than the whole package.  If you 
> don't understand, here is an example!!!
> 
>  
> 
> ASM Demo
> 
>  
> 
> 01111000 -> 00111100 -> 00011110 -> 00001111 -> 10000111 -> 
> 11000011 - > 11100001 -> 11110000 -> 01111000 -> 00111100
> 
>  
> 
> My Program using either (temp >>=1) or (temp <<= 1)
> 
>  
> 
> 01111000 -> -> 00111100 -> 00011110 -> 00001111 -> 00000111 
> -> 00000011 -> 00000001 -> 00000000 -> 10000000 -> 01000000 
> -> 00100000
> 
>  
> 
> I have include the latest build, and if anyone know how to 
> fix it, please let me know, and I will put your name in the 
> author place as well!!!
> 
>  
> 
> Thanks
> 
>  
> 
> Steven
> 
>  
> 
> __________________________________________________________________
> Steven Chang-Lin Yu
> ICQ#: 66369374
> 
> 
> Current ICQ status:  
> 
> 
> 
> * Home Tel#:  0401043641
> * Work Tel#:  0401043641
> *  HYPERLINK "http://wwp.icq.com/66369374"More ways to contact me 
>        HYPERLINK "http://wwp.icq.com/target=";
> 
>  
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.564 / Virus Database: 356 - Release Date: 19/01/2004
>  
>     
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
>  
> 
> Yahoo! Groups Links
> 
> To visit your group on the web, go to:  
> http://groups.yahoo.com/group/avrclub/
> 
> To unsubscribe from 
> this group, send an email to:  address@hidden
> 
> Your use of Yahoo! Groups is subject to:  
> http://docs.yahoo.com/info/terms/ 
> 
> 
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]