Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 40
61  Forum 2005-2010 (read only) / Development / Re: Library Repository on: October 15, 2007, 11:11:27 pm
I'm for the idea. Libraries at the moment need a little bit of work to get going.
It would be nice if they were one click install and autoupdating.
62  Forum 2005-2010 (read only) / Development / Re: __inline__ setup and loop? on: October 09, 2007, 01:07:48 am
Quote
Hmm.  The pattern doesn't look right to me, but perhaps one of us copied it wrong.
How about this (you'll need to change the output function to output the low 24 bits of "leds" to the three 595s):
One of each LED is lit so there is a blue LED following a green LED following a red LED.
Hence the 3 temp variables.

The 'mismatch' of the pattern is because there is a hidden 9th 'led' so it wraps properly.

Quote
(it does much better if leds is a local variable (is there a way in gcc to get global variables to be stored in registers?)):
Hmm I dont think its possible to make it local.
I've got a nice system where the animation changes every 5 seconds and it wouldnt work without code in loop() calling the (inlined) animation functions.
Plus each animation function reuses the variables.

Actually I wonder if inlining would basically do the same thing anyway.
63  Forum 2005-2010 (read only) / Development / Re: __inline__ setup and loop? on: October 08, 2007, 09:28:35 pm
Its a RGB LED chaser. Each 595 handles one colour.
A red, green and blue LED chasing each other.

Not entirely sure why turning on a LED requires a 0 but meh.
64  Forum 2005-2010 (read only) / Development / Re: __inline__ setup and loop? on: October 08, 2007, 07:23:09 pm
Quote
Ah, youthful optimism.  Your code is NOT "done the best way possible" if "few people can understand it."  Period.
Ok a example:
Code:
 tmp1 = 0xFF - (1 << led);
  tmp2 = 0xFF - (1 << (led + 3 > 8 ? led - 6 : led + 3));
  tmp3 = 0xFF - (1 << (led + 6 > 8 ? led - 3 : led + 6));
  writeoutput(d);
  led++;
  if (led == 9)
  {
    led = 0;
  }
writeoutput dumps tmp1, tmp2 and tmp3 out in order to three 595's. Ignore the d parameter.

Guess what it does. smiley
Most people wouldnt have a clue yet it works and I'm pretty sure its the fastest way to do it.

I havent checked the assembly created by that yet so I havent optimized it fully.
I think its pretty good though.

Quote
My pet peeve is millis(), which ends up importing many bytes of 32bit divide function so that delay() will be closer to actual milliseconds than the 2.5% off you'd get using the native clock tick of 1.024ms.
Imho for things like that there should be two functions: one for imprecise measurements and one for precise measurements. Imprecise being the default.
That way the excess code is excluded unless specifically required.
65  Forum 2005-2010 (read only) / Development / Re: __inline__ setup and loop? on: October 08, 2007, 05:06:06 am
Its a annoying habit of mine. smiley

I like things to be done the best way possible.
Consequently, few people can understand my 'cooler' code. It always works brilliantly though.

Quote
and I don't even see yelling and screaming to reduce that 2K to 1K by streamlining the bootloader.
Well now that you mention it.... ;D
66  Forum 2005-2010 (read only) / Development / Re: __inline__ setup and loop? on: October 06, 2007, 07:40:55 am
Well with functions which are only called in one place, such as setup() and loop(), it removes the function call and basically copy pastes the code from the function in to where it was called.

Straight away it reduces the program by a few bytes but its real impact comes from loop().

Function calls cost a few cycles. loop() is called in a infinite loop so especially with smaller programs, it can give a little speed boost.

Its basically just a more efficient way of doing things.
67  Forum 2005-2010 (read only) / Development / __inline__ setup and loop? on: October 06, 2007, 04:20:29 am
Inlining them by default would save a couple of bytes and probably a decent speed increase (depending on application).

Either that or the ability to manually make your own main() would kick ass.smiley
68  Forum 2005-2010 (read only) / Development / Re: Arduino is not fully open source on: September 28, 2007, 11:35:32 pm
You can probably get the source for those files from Wiring.

You can write low level code.
Check the datasheet for the assembler and opcode information.
One thing I like doing is compiling the C code with -S. That makes gcc spit out the assembly code.
69  Forum 2005-2010 (read only) / Development / Re: Passing ProgMem array to function on: September 24, 2007, 03:17:56 am
Code:

void playMessage(prog_uchar* message){
  
maxStringSize =  sizeof(message);  // find message size
}

void loop() {
  playMessage(signMessage);
}


There fixed. smiley
The function has to come before you call it. Alternatively you can use a header file.
70  Forum 2005-2010 (read only) / Development / Re: How fast is the Arduino? on: September 18, 2007, 04:59:26 pm
Quote
How many brightness levels?
Obviously not a lot. 4 or 8 would satisfy me well.
71  Forum 2005-2010 (read only) / Development / How fast is the Arduino? on: September 18, 2007, 07:22:15 am
Well I'm going to attempt and control 192 outputs simultaneously (8x8x3 leds).

I'm sure the Arduino can handle that fairly easily.
The question is how well will stuff like software PWM work?
I dont actually have mine yet so I cant tell its speed easily.

Options:
A) Hopefully if its fast enough I'll be able to talk to a computer in a different protocol, translate it to the 595's protocol and do PWM all at the same time.
I know how to optimize it so my code will be fast but its a massive amount of work.

B) Make the computer give the data to it in as similar to the 595's protocol as possible.
That way it only needs to proxy data and apply PWM.

C) Toss the idea of emulated PWM out the window.

Which one is more realistic?
Also would getting a 20mhz crystal help?
72  Forum 2005-2010 (read only) / Troubleshooting / Re: Is my sparkfun serial lcd defective? on: February 10, 2008, 02:08:30 am
Talk to Sparkfun about it.
73  Forum 2005-2010 (read only) / Troubleshooting / Re: a vin-pin and manual of the Arduino on: February 06, 2008, 03:04:12 am
Your looking for the playground. smiley

For the I2C stuff look at the Wire library's page.

Vin is indeed the same as what you plug in to the external power plug.
Aref is used to change the reference voltage for ADC conversions. Usually not needed.
74  Forum 2005-2010 (read only) / Troubleshooting / Re: Getting Arduino Running on PCLINUXOS on: February 02, 2008, 07:39:41 pm
If I were you I'd make a new page on the playground and put the instructions there like the Slackware page. smiley
75  Forum 2005-2010 (read only) / Troubleshooting / Re: mini on 3.3v on: January 19, 2008, 02:40:55 am
Quote
Of course, I wouldn't expect the USB chip to work, and I'm not sure that straight serial would either.
As long as its inputs are 3.3v tolerant which they should be then it should work fine. smiley
It gets powered by the USB bus I think even when the Arduino isnt. Double check the schematic.

There is nothing wrong with overclocking a AVR either. smiley-wink
Pages: 1 ... 3 4 [5] 6 7 ... 40