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

2005-11-16 Thread Mike S.
Thanks to all for the replies! I learned a lot! I decided to use the SPI module, it works fine! Best Regards Bruno On 11/10/05, David Brown [EMAIL PROTECTED] wrote: I suspect you misunderstand what optomization means, especially when applied to a small microcontroller. Choosing -Os (or -O2,

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

2005-11-10 Thread David Brown
I suspect you misunderstand what optomization means, especially when applied to a small microcontroller. Choosing -Os (or -O2, which is very similar) tells the compiler to generate small and fast code. It is not dangerous or risky. Gcc does have a few risky optomisation passes that you can

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

2005-11-09 Thread Daniel O'Connor
On Wed, 9 Nov 2005 21:25, Mike S. wrote: Thanks for the reply Daniel O'Connor, but I usually don't use the optimization until I try a couple of and optimization techniques. I already had some bad experiences with the optimization in some Texas Instruments DSPs... If you don't tell GCC to do

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] AVR assembly for fast bit bang

2005-11-09 Thread Peter Fuhrmann
void write_data (Word towrite, Byte nbits) { Byte n; for(n = 0; n nbits; n++) { CLK_HIGH; if( towrite (0x0001 n)) { SDIO_HIGH; } else { SDIO_LOW; } CLK_LOW; } } This will give very slow code, because a left shift by a

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

2005-11-09 Thread Nigel Winterbottom
You'll find this modification / correction helps with speed because you don't have to evaluate (1n) each time through the loop. Only a single bit shift on the 16-bit value is required. #define ADS1210_PORT PORTF #define SDIO_BIT 0x04 /* 0b 0100 PORTF.2*/ #define CLK_BIT 0x02 /*

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

2005-11-09 Thread Nils Springob
Hi, I think there are two problems with the code: - using 16 bit data - shifting by a variable number of bits An optimization would be to write a funktion which only shifts up to 8 bit, and to shift the data every time by one bit. Regards, Nils original code: void write_data (Word towrite,

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

2005-11-09 Thread David Kelly
On Wed, Nov 09, 2005 at 09:00:58AM -0500, Dave Hansen wrote: From: David Kelly [EMAIL PROTECTED] [...] People keep saying C isn't fast enough. I don't belive it. First attempt: [...] It might be tough to do better on AVR. My standard SPI routine uses a do-while loop, which might save an

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

2005-11-08 Thread Mike S.
Hello to all,Can anyone tell me the best (faster) way to implement bit shifting (serial synch protocol-in a bit bang fashion-) with two general purpose digital pins (one pin for data the other for clock)? Using C is not fast enough! I need assembly! Thanks in advance Best Regards (I use the

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

2005-11-08 Thread Hugo González Monteverde
Hi Mike, Do you have any code for the C implementation of what you are trying to do? What protocol are you implementing? is it SPI one way? TWI? what frequency will the clock be? Will you be using interrupts in any way, or how will you do your communication? 90CAN128 is a high performance uC

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

2005-11-08 Thread Daniel O'Connor
On Wed, 9 Nov 2005 02:15, Mike S. wrote: Hello to all, Can anyone tell me the best (faster) way to implement bit shifting (serial synch protocol -in a bit bang fashion-) with two general purpose digital pins (one pin for data the other for clock)? Using C is not fast enough! I need

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

2005-11-08 Thread David Kelly
On Tue, Nov 08, 2005 at 03:45:54PM +, Mike S. wrote: Hello to all, Can anyone tell me the best (faster) way to implement bit shifting (serial synch protocol -in a bit bang fashion-) with two general purpose digital pins (one pin for data the other for clock)? Using C is not fast enough! I