Show Posts
Pages: 1 ... 645 646 [647] 648 649 ... 1853
9691  Using Arduino / Microcontrollers / Re: Using ICSP and SD Board on SPI pins on: August 07, 2013, 07:57:19 am
You can increase the size of the status area at the bottom of the IDE window - move the mouse slowly over the dividing line until you see the double-arrow cursor - make the bottom bigger by dragging it up.  Then you can scroll up & down within it.
The info shown there can all be copied - so much that it can  be more than you can post here.
Go up to part after the code compiles, where it says "Compiled xxx of xxx bytes", and see if there is message about the device signature it actually sees.
9692  Using Arduino / General Electronics / Re: make Arduino tutorial NOT using embeded LED on: August 07, 2013, 07:47:54 am
So you want to combine the two?
Connect the push button between pin 2 and Gnd, use the internal pullup resistor instead. The pin will  be High when the button is not pushed, and Low when it is pushed.
Connect the LED anode to pin 12, cathode to resistor to Gnd.
Code:
byte ledPin = 12;
byte buttonPin = 2;

void setup(){
pinMode (buttonPin, INPUT_PULLUP);
pinMode (ledPin, OUTPUT);
Serial.begin (9600);
}

void loop(){
if (digitalRead(buttonPin) == LOW){
digitalWrite (ledPin, HIGH);
Serial.println("button closed");
}
else{
digitalWrite (ledPin, LOW);
Serial.printlt ("button open");
}

Make sense?
9693  Using Arduino / Programming Questions / Re: Possibly insane question on: August 07, 2013, 01:51:33 am
I thought the Mega could control 48 stepper motors?
Oops - 48 servo motors. Never mind.
http://arduino.cc/en/Reference/Servo

Steppers, need more control lines as was pointed out above.
http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors/
9694  Using Arduino / Audio / Re: Storing data in an audio channel on: August 07, 2013, 01:42:30 am
Don't know, never measured one.
You could try a simple test - use an arduino to make various test pitches, see what a video recorder with mic will pick up.
Simple high/low output loop with various delays.

9695  Using Arduino / LEDs and Multiplexing / Re: Led cube efficiency on: August 07, 2013, 01:27:25 am
NOT 74HC595 - that part sucks for current source or sinking, 70mA total for the part, just 8-9mA per IO.
TPIC6B595 much better.
9696  Using Arduino / General Electronics / Re: Getting pretty hot from 12v supply on: August 06, 2013, 10:25:50 pm
Quote
I've read those things are killing people!
What, are they choking on them? Keep them out of your mouth!
9697  Using Arduino / Installation & Troubleshooting / Re: Accidental Short. Wondering what the component marked 501N is? on: August 06, 2013, 04:44:12 pm
That's what I thought. Luckily it is a big part, shouldn't be too hard to unsolder and put a new one on.
Or leave it there and jumper another across it, see if the parts downstream of it are still good.
9698  Using Arduino / LEDs and Multiplexing / Re: Led cube efficiency on: August 06, 2013, 04:37:29 pm
NOT 74HC595 - that part sucks for current source or sinking, 70mA total for the part, just 8-9mA per IO.
TPIC6B595 much better.
9699  Using Arduino / Microcontrollers / Re: Using ICSP and SD Board on SPI pins on: August 06, 2013, 12:40:49 pm
Could it be as simple as just fixing the signature bytes being called out?
ATmega644   0x1E 0x96 0x09
ATmega644A   0x1E 0x96 0x09
ATmega644V   0x1E 0x96 0x09
ATmega644P   0x1E 0x96 0x0A
ATmega644PA   0x1E 0x96 0x0A
ATmega644PV   0x1E 0x96 0x0A

If you think the SD card is interfering, make sure you have a pullup on the Arduino pin that drives the SD chip select pin (before any buffer chip if you have one) so that when reset is pulled low by the programmer and the Arduino IO pins go into high impedance mode (i.e. floating) the CS pin is high.

You say 4 jumpers on 6-pin header - which are you leaving off? MISO-MOSI-SCK-RESET-GND are all required, and most programmers either provide 3.3V or 5V to the board being programmed, or else monitor the supply pin and adjust the levels they drive to match (Atmel MKii for example).
9700  Using Arduino / Programming Questions / Re: Reading Bits from Registers on: August 06, 2013, 11:52:30 am
Bytes have 8  bits, by convention they are numbered 7-0 from MSB to LSB. If you talk to any engineer, 0 will always be the LSB. The datasheet also calls them 7-0.
You can reference them however you want in your program as long as you are consistent in their usage. Anyone reading your code will question you on it for not following convention.

As far as setting & clearing bits, I often do this to set & clear bits when using SPI for fast transfers.
(I don't use the macro conventions because as a late comer to C/C++ progamming I didn't realize all the stuff existed - and now that I know they do, I like the direct manipulation better because its easier for me to see what I am doing).
For example, using PortB bit 4 as the latch/output register clock to send data out to 4 shift registers that are driving 7-segment displays:
Code:
PORTB = PORTB & B11101111; //clear bit 4
for (x=0; x<4; x=x+1){
SPI.transfer(fontArray[dataArray[x]]);  // fontArray is the mapping of Segments to output pins, dataArray holds the digits to display
}
PORTB = PORTB | B00010000; // set bit 4
Timing tests show that the for loop adds ~12uS for every pass thru, so when I'm looking for even faster I would use 4 SPI.transfer commands instead and skip the for loop:
Code:
PORTB = PORTB & B11101111; //clear bit 4
SPI.transfer(fontArray[dataArray[0]]);
SPI.transfer(fontArray[dataArray[1]]);
SPI.transfer(fontArray[dataArray[2]]);
SPI.transfer(fontArray[dataArray[3]]);
PORTB = PORTB | B00010000; // set bit 4
And if I'm concerned about going really fast I'll skip SPI.transfer and write to the SPI register directly and follow with a bunch of NOPs vs waiting for SPI.transfer to detect an interrupt showing the transfer is complete so it can send another byte (I think that's the correct explanation). Nick Gammon turned me on to this method.
(I need to confirm, I think SPDR and 16 nop's (no-op) is correct - takes 16 clocks to move 8 bits out, so the register write and then 16 clocks. I checked this once with a logic analyzer to confirm the nops moved all the data out correctly, playing around with adding/deleting until I had good data going out every time)
Code:
PORTB = PORTB & B11101111; //clear bit 4
SPDR=(fontArray[dataArray[0]]);nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop;nop;
SPDR=(fontArray[dataArray[1]]);nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop;nop;
SPDR=(fontArray[dataArray[2]]);nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop;nop;
SPDR=(fontArray[dataArray[3]]);nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop; nop;nop;nop;nop;
PORTB = PORTB | B00010000; // set bit 4

Some might say doing that isn't very portable across devices. I personally don't give a hoot about that as I'm writing code for a specific device and I want it to go fast. PORTB-4 is the SS pin on as 1284. If I go and copy this code for use on a 328 then I'll have to remember to change it to PORTB-2.

So there's a hardware engineer's perspective for you smiley-cool
9701  Community / Bar Sport / Re: What would be your Company Name? on: August 06, 2013, 09:24:54 am
SEMAF Electronics Import & Export
9702  Using Arduino / Programming Questions / Re: Reading Bits from Registers on: August 06, 2013, 09:21:05 am
You can also discretely mask for the bits:
Code:
if ((PINA & B00010000) == 0){
// do one thing if bit 4 for example is low
}
else {
// do something else if bit is high
}
9703  Using Arduino / Installation & Troubleshooting / Re: Accidental Short. Wondering what the component marked 501N is? on: August 06, 2013, 09:02:48 am
Yes, that's the PTC resettable polyfuse that's supposed to protect against USB current draw over 500mA.
Do you measure very low resistance across it? Or did it go open?
9704  Using Arduino / General Electronics / Re: "Quick and dirty" question on: August 06, 2013, 08:04:46 am
Use 5V from the Arduino, they need very little current - 10K pot will draw just 0.5mA.
Use 3-conducter (+5, Gnd, Signal) shielded wire, with the shield itself grounded on just one end.
Decoupling caps would be good - 24V into a 7805 might be pushing it, on the other hand you are not drawing much 5V current.
9705  Using Arduino / Sensors / Re: reading pushbutton. only if HIGH for 5 sec or more, start next routine on: August 06, 2013, 07:58:51 am
Cool. Not bad for making it up on the fly, eh!
Pages: 1 ... 645 646 [647] 648 649 ... 1853