Show Posts
Pages: 1 2 [3] 4 5 ... 23
31  Using Arduino / Programming Questions / Re: Setting up ADC ..am i setting the right bits? on: July 18, 2013, 02:35:40 pm
The program triggers only one conversion, when it writes to ADCSRA.  If that conversion doesn't yield a value that's high enough, it'll never light the LED.
According to this, if i set ADATE to one it will look into ADTS0-2 to enable a certain trigger, and if they are all low it will be in free running mode , i did not have the ADATE enabled but i just did and still nothing

32  Using Arduino / Programming Questions / Re: Setting up ADC ..am i setting the right bits? on: July 18, 2013, 02:27:07 pm
Code:
        //Setting up ADC
        ADMUX |= ((1<<REFS0) | (1<<REFS1)  | (1<<ADLAR) | (1<<MUX0) | (1<<MUX1)); // set the ref voltage , set the left adjust , set the analog input pin

You are ORing whatever value happens to already be in the ADMUX register with the complete desired value.  What would happen if the MUX2 bit was already set?  What channel would you be reading instead of of channel 3?

Code:
ADCSRA |= ((1<<ADEN) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2) | (1<<ADSC)); //enable ADC , set the prescale , start conversion

You are ORing whatever value happens to already be in the ADCSRA register with the complete desired value.  What would happen if the ADATE bit was already set?  Would the converter work the way you expect?

At what point do you wait for the conversion to complete?




Datasheet says they are all initialized at 0  , so im assuming leaving those bits untouched leaves them at zero , nonetheless i can also directly set them to zero to see if that helps.
33  Using Arduino / Microcontrollers / Re: AVR Dragon on: July 18, 2013, 09:31:56 am
Oh and there's no Arduino code..no digitalwrite this or analog read..you have to use embedded C . Which is  not hard either. Oh and your arduino libraries are no good. But atmel studio has its own tools. And then you might want to join the AVR freaks forum.
34  Using Arduino / Microcontrollers / Re: AVR Dragon on: July 18, 2013, 09:26:42 am
An AVR dragon is Atmels in system debugger / programmer
To use it you will need to program the microcontroller with out using Arduino.
Via SPI or Jtag..mostly you'll probably use spi

Unlike the Arduino when programming Avr you will also probably want to use Atmel Studio 6 , which is free. Furthermore with an avr programmer you have the ability to use Atmels 8-32 bit uC's which all together I think there's probably over 200 different microcontrollers you can pick from even the ARM core based.  If your looking to make something for professional commercial use and do not wish to publish your source or board design then go for it. If your just a hobbyist then I think the arduino line will suit most if not all your needs.
35  Using Arduino / Programming Questions / Re: Setting up ADC ..am i setting the right bits? on: July 18, 2013, 08:11:35 am

Processor?

Quote
since it was left adjusted

Why?


328p.
And its left adjusted so that I may get the 8 most significant bits, out of the 10, in the high byte and only read the high byte ..8 bit resolution is fine.  I am only trying to learn how to use the adc at the moment.
36  Using Arduino / Programming Questions / Re: Setting up ADC ..am i setting the right bits? on: July 18, 2013, 08:09:29 am
Code:
               {
PORTB |= (1<<PINB5);
}
else
{
PORTB |= (0<<PINB5);
}
 


This won't toggle anything. What do you suppose "or"ing in zero will do?

Your right I will fix that when I get home. Though the led does not even turn on . And yes it does work And Is wired properly.
37  Using Arduino / Programming Questions / Setting up ADC ..am i setting the right bits? on: July 18, 2013, 12:01:28 am
Ive been reading the datasheet and i think i understand it but not gettingthe result im looking for.
all that is going to happen is an led toggle once a threshold has been breached
Code:
#include <avr/io.h>

int main(void)
{
DDRB |= (1<<PINB5);


        //Setting up ADC
        ADMUX |= ((1<<REFS0) | (1<<REFS1)  | (1<<ADLAR) | (1<<MUX0) | (1<<MUX1)); // set the ref voltage , set the left adjust , set the analog input pin
DIDR0 |= (1<<ADC3D); //disable digital input on that analog pin

ADCSRA |= ((1<<ADEN) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2) | (1<<ADSC)); //enable ADC , set the prescale , start conversion




while(1)
{

if(ADCH >= 50 ) //read hight byte of adc register , since it was left adjusted
{
PORTB |= (1<<PINB5);
}
else
{
PORTB |= (0<<PINB5);
}
}
}

as far as wiring all i have is a pot with outter leads going to a common ground and 5v and middle lead going to analog input 3.
since reference voltage is set to internal 1.1v  via the REFS0 bit & REFS1 ,  i dont need anything at the Aref pin , it does reccomend a cap at the aref pin either way and its there
38  Using Arduino / Programming Questions / Re: LOW = HIGH and HIGH = LOW on: July 16, 2013, 11:30:19 pm
then go on youtube and search for Arduino  turoials theres a  million.
39  Using Arduino / Programming Questions / Re: LOW = HIGH and HIGH = LOW on: July 16, 2013, 11:29:29 pm
why dont you try this..ONE single LED at a time

1 led 1 resistor 3 wires.

connect the short lead of the led to a resistor then the other end of the resistor to the ground rail of the breadboard.

then connect 1 wire from gnd on the Arduino to the ground rail on the breadboard

then connect the other lead, the long lead, of the led to pin2.

then

in your arduino load the "Blink" sketch from the menu: File>>Examples>>Basics>>Blink

change 13 to 2. then upload and your done.
40  Using Arduino / Project Guidance / Re: How to send message? on: July 16, 2013, 10:23:33 pm
try it out and see   smiley-twist
41  Using Arduino / Programming Questions / Re: LOW = HIGH and HIGH = LOW on: July 16, 2013, 10:19:34 pm
What type of code is this?

An awkward combination of port manipulation and Arduino functions.

yeah i was just showing him the for loops , i think accessing the ports might be a bit over his head
42  Using Arduino / Programming Questions / Re: LOW = HIGH and HIGH = LOW on: July 16, 2013, 10:18:06 pm


What type of code is this?
[/quote]


It is slightly more efficient code then what you have and does the same thing your doing.
43  Using Arduino / Programming Questions / Re: LOW = HIGH and HIGH = LOW on: July 16, 2013, 10:16:11 pm
even though that pictures is extremely hard to see i can almost tell you 100% you need to turn your Arduino off as you read this and rewire that up.

You have all the LEDs sourcing power from the 5v pin then you also have them all connected to digital pins 2-6
technically they are never really grounded. what you are doing right now is giving it 5v from both sides
when you turn the pin on.

Look man , unplug the that wire connecting everything to the 5v pin and plug that into ground instead.
44  Using Arduino / Project Guidance / Re: How to send message? on: July 16, 2013, 10:08:06 pm
to send the words you would use Serial.print and parse the data on the flyport side
because Serial.write sends binary data
45  Using Arduino / Project Guidance / Re: How to send message? on: July 16, 2013, 09:55:01 pm
if they are both Arduinos you can use the UART , just connect ones Rx to the others Tx and have them at the same baud rate , you can even add parity bits to check if the message is coming across correctly etc..
Pages: 1 2 [3] 4 5 ... 23