Show Posts
Pages: 1 ... 65 66 [67] 68 69 ... 73
991  Using Arduino / Installation & Troubleshooting / Re: Uno wont load sketches (avrdude) trying to use Mega 2560 as ISP on: February 01, 2012, 12:45:43 pm
Why are you programming an Arduino board through an ISP?

The error message indicates that you have the wrong processor selected. What do you have selected as a board, and what do you have selected as ISP?

If you are running the ArduinoISP sketch you would want to select that as the programmer, and you have to select a board with the same processor as you are trying to program.

Also - Are you running the ArduinoISP sketch from Arduino-1.0 or from Arduino0.22? the sketch in 1.0 needs to be have teh serial speed changed (Serial.begin(9600) instead of (19200)) and teh serial speed changed in the AVRDude command.

expect=0x14, resp=0x64 would suggest that you have a 328 (the Ox14) not sure what 0x64 processor is.

you might try adding a -F in the command string so AVRDude will ignore the processor type.
avrdude -P com7 -b 19200 -c avrisp -p m328p -v -F -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m
992  Using Arduino / Motors, Mechanics, and Power / Re: Arduino chip as Stepper Controller on: January 31, 2012, 03:24:55 pm
Got to playing with assembly language - took my code size from 1200 bytes to 86 bytes.

Out of necesity, Arduino adds a lot of overhead to interrupt routines. Saves all the registers and such, but it would take a lot more power to analyze the code and reduce that overhead. Writing in assembler means I had to do the optimizing and I am responsible for what can go wrong...

I am using AVRStudio 4 to write and test the code (has a simulator built in)(even has a disassembler that will load the hex files and list them )
I recommend AVR Studio 4 over 5 as 5 is just to S-L-O-W...

Here's what the code looks like in assembler.
.INCLUDE "" ; Header for ATTINY2313A
; ============================================
;   R E G I S T E R   D E F I N I T I O N S
; ============================================
.DEF Conf = R16 ; Multipurpose register
.DEF StepCt = R17
.DEF StepMask = R18
.DEF Direction = R19
.DEF PortBHold = R20
.DEF PortDHold = R21
.DEF PortDMask = R22
.DEF SeqBase = R23
; ============================================
;   R E S E T   A N D   I N T   V E C T O R S
; ============================================
.ORG $0000
rjmp Main ; Reset vector
rjmp Step ; Int vector 1
rjmp Dir ; Int vector 2
reti ; Int vector 3
reti ; Int vector 4
reti ; Int vector 5
reti ; Int vector 6
reti ; Int vector 7
; ============================================
;     I N T E R R U P T   S E R V I C E S
; ============================================
Step: add StepCt,Direction
      and StepCt,StepMask
      mov ZL,SeqBase
 add ZL,StepCt
 Lpm PortBHold,Z
 out PORTB,PortBHold
Dir:  ldi PortDMask,8
      in  PortDHold,PIND
      and PortDHold,PortDMask
      breq SinNeg
 ldi Direction ,1
      rjmp DirEx
SinNeg:  ldi Direction ,-1
; ============================================
;     M A I N    P R O G R A M    I N I T
; ============================================
; Init stack
ldi Conf, LOW(RAMEND) ; Init LSB stack
out SPL,Conf
; Init Port A
ldi Conf,0 ; Direction Port A
out DDRA,Conf
; Init Port B
ldi Conf,(1<<DDB0)|(1<<DDB1)|(1<<DDB2)|(1<<DDB3) ; Direction Port B
out DDRB,Conf
; [Add all other init routines here]
ldi Conf,(1<<SE)|(0<<ISC00)|(1<<ISC01)|(1<<ISC10)|(0<<ISC11) ; enable sleep
out MCUCR,Conf
ldi StepCt,0
ldi StepMask,7
ldi Direction,1
ldi SeqBase, StepSeq
add SeqBase,SeqBase
; ============================================
;         P R O G R A M    L O O P
; ============================================
rjmp loop ; go back to loop

StepSeq: .DB 1,3,2,6,4,12,8,9,0,0
; End of source code
993  Using Arduino / Programming Questions / Re: using struct command on: January 31, 2012, 02:32:32 pm
A struct is a way of grouping several variables together under a common name. The variables in the struct do not have to be the same type.

A common example (outside of the Arduino IDE) was  an address record or struct(ure) you hade name, address, zip,, and other realted data all stuck in 1 struct because of their relationship.

so - you have created a struct with values for the 3 colors at that point -
struct CRGB { unsigned char r; unsigned char g; unsigned char b; };
this is desctibing a record with the values for R, G ,& B

You then describe another struct using the same name (probably adds to the confusion) that is an array of the previous struct

I would have thought you would have done this -
struct CRGB { unsigned char r; unsigned char g; unsigned char b; };
 and use it as a new type , and then define an array -
CRGB leds[60];

and you would address them as leds[1].r, leds[1].g and leds[1].b

You are calling a function -     
strip.setPixelColor((m - 1), 0, 0, 0);
which probably has something like this -
strip.setpixel (int index, unsigned char red; unsigned char green; unsigned char blue)
 and has code something like this -
but this allows you to work with a "variable"  called leds[] that contains multiple values, but to be handled as one chunk.
994  Development / Other Software Development / Re: Simulator for Arduino on: January 30, 2012, 05:32:29 pm
Does it allow you to simulate external interrupts?
995  Development / Other Software Development / Re: My newest development in interfacing arduino with input hardware on: January 30, 2012, 05:29:26 pm
Are there any more grey codes?
There will be, I haven't looked at them for years but IIRC there are versions with a lot more codes than you have there, a grey code after all is just a code where only a single bit changes for every new value.

Grey codes are normally used for absolute encoders I thought, a relative encoder should have no need for such things.


No - Gray codes are used for relative encoders, Allows you to get your information in 2 bits and keep track of position in software. Absolute encoders have either a whole bunch of wires or use some serial/parallel protocol to give position.

I have seen 2, 3, & 4 bit grey codes. 2 bit is most common, with a Z bit thrown in that goes true for exactly one sequence of the code in every revolution of the shaft.
996  Development / Other Software Development / Re: Visual Micro - Arduino for Visual Studio on: January 30, 2012, 05:24:02 pm
Only 1 slight problem... If you don't have the latest and greatest in computers, then Visual Studio 2010 takes all day to get anything done. It is another piece of Microsoft bloatware.(for the record - I am a VB6 and Visual Studio 2000 user) I tried running VS 2010, and AVR Studio 5 and found them both to be agonizingly slow. Visual Studio 2008 isn't much better.
997  Using Arduino / Motors, Mechanics, and Power / Re: Current limiting circuitry for servos on: January 30, 2012, 05:09:01 pm
Your power supply should have a + voltage and a Common or ground. Ground from your servo power supply should be connected to Arduino Ground. Servos don't need current limiting resitors.

If you don't supply the servos from both sides of the supply they won't work...
998  Using Arduino / Motors, Mechanics, and Power / Re: What kind of motor is this? on: January 30, 2012, 05:05:27 pm
It is actually a five wire stepper motor that can be wire Unipolar or Bipolar.
BiPolar works if you have an H-Bridge driver to connect to the motor.

It will also work if you have 4 transistors, the transistor's collectors to ABC&D, Base to Arduino pins, and emitters to ground,  and the power supply to O on the motor, then sequence a, b, c, d for simple stepping, A, AB, B,BC,C,CD,D,DA, etc for 1/2 stepping.
999  Using Arduino / General Electronics / Re: Kickback Diode On Motor - question on: January 30, 2012, 11:14:42 am

I don't think so. The diode connected across the transistor is the wrong way round to conduct reverse voltage from the coil when the current through it is interrupted, unless it is a Zener diode.

However, in an H-bridge with diodes across all the transistors (or the body diodes of mosfets), you're right, those diodes contain the back EMF by feeding it into the power supply.

The diodes are doing the same job in either position. the diode across the transistor is there specifically to protect the transistor from reverse transients from switching off an inductive load. The Diode across the motor would short the voltage spikes through just the motor and would stress other elements of the circuit less. The capacitor would be a good addition for either a motor or a coil, just make sure it has a high enough voltage rating for the spike.
1000  Using Arduino / Motors, Mechanics, and Power / Re: Motor causing Arduino to Brownout on: January 26, 2012, 06:24:17 pm
First thing would to be use a bigger power supply. When starting a motor, the initial instantaneous current can be a lot higher than the 500ma you are quoting. You could, depending on the motor size and load pull much higher currents and thus are dropping below 6-7 volts and the regulator shuts off the arduino.
1001  Using Arduino / Microcontrollers / Re: ISP! on: January 26, 2012, 06:04:52 pm
If you are using the Arduino-1.0 IDE to load the ArduinoISP sketch you will have a problem.

Geta copy of Arduino-0.22 and load the ArduinoISP sketch and then the Arduino board will work just fine.

If you are using AVRDude to transfer a HEX file, the Arduino-0.22 sketch will run at -b 19200, the Arduino-1.0 sketch will run at -b 9600. If you are not running AVRDude directly this won't mean a thing to you.
1002  Using Arduino / Microcontrollers / Re: ####ing attiny85 on arduino... on: January 26, 2012, 05:58:23 pm
Arduino 1.0, as I understand it, made a change in the serial library that sort of crashed ArduinoISP when loaded from 1.0. It will work at 9600 (if you change the serial setup in the sketch) when using AVRDude from the command line, the 22 version will work at 19200 AND will tranfer from 1.0 using the transfer using ISP option.
1003  Using Arduino / General Electronics / Re: current maximums on the output pins on: January 26, 2012, 05:49:33 pm
Download a copy of the datasheet (if you haven't already) and look at the pin descriptions. They will have as part of the naming - PB0, PB1,PB2..., PC0, PC1,PC2..., PD0, PD1, PD2, PD3... and such. these are the port groupings. Then map those groupings to you setup and to that chart and you should have a pretty good idea whether you are pushing the current limits.

Page 2 of the datasheet shows the pinouts and names them all.

And here is the datasheet.
1004  Using Arduino / General Electronics / Re: Critique my circuit: Poor man's UPS on: January 26, 2012, 05:40:04 pm
Why not use some recharge-ables and leave them in the circuit all the time. At least then you won't have the system failing because someone forgot to change the batteries. Then you power supply just has to be regulated to the proper voltage for the batteries. NiCads peak out at approx 1.25 V/cell and run through a good part of their discharge cycle approx 1.2 V/cell so you coud regulate to 5V and supply that 5V after the regulator, straight to the arduino and the batteries.
1005  Using Arduino / General Electronics / Re: Relay activating without signal on: January 26, 2012, 05:21:46 pm
Do you have any capacitor after the 5V regulator? You are getting some noise and it might well be the current in the circuit when you release on of the other relays is causing the radio relay to trigger. As it only requires a pulse, that might just be where the noise shows up, the others require an physical action and they may not have a long enough pulse for you to hear the siren or see the flash. Relays are noisy devices and you will probably need a capacitor to take care of that noise.

A good place to  start would be a 10 micro farad, 25 V electrolytic on the input and output of the regulator.
Pages: 1 ... 65 66 [67] 68 69 ... 73