Show Posts
|
|
Pages: [1] 2
|
|
2
|
Forum 2005-2010 (read only) / Interfacing / Direct reading of a PORTD bit
|
on: February 23, 2010, 08:54:08 am
|
|
In the code below if I use digitalRead(6) I can read the logic level on my PortD Pin6. If I use the Led = PORTD & B11000000 statement I do not get bit6 wiggling as I'd expect.
What am I doing wrong?
void setup() { Serial.begin(9600); // prints title with ending line break Serial.println("Setup starting"); // The Data Direction Register of Port D, don't touch the // lower two bits which are serial IO DDRD = DDRD | B00111100 ;
}
void loop() { int i = 0 ; int iLed = 0 ; while (true) { // iLed = digitalRead (6) ; iLed = PORTD & B11000000 ; Serial.println("iLed ="); Serial.print(iLed, OCT);
|
|
|
|
|
4
|
Forum 2005-2010 (read only) / Interfacing / Replacement for STP16CL596 (16 bit shift register)
|
on: September 09, 2010, 08:29:45 am
|
|
Is there a replacement for STP16CL596?
The DIP version of this chip was ideal for a project I have in mind (tons of LEDs (yawn!)) but I've seen on the WEB that they are out of production?
Does anyone know if this is true, and if it is true is there a replacement out there? It has to be at least 10 bits and hopefully able to drve LEDs at 25ma directly...
I know there are some 74 and 4000 16 bit registers, but not sure that they can drive all 10 leds without overheating...
TIA!
|
|
|
|
|
5
|
Forum 2005-2010 (read only) / Interfacing / Re: Sensing wavelength of lights
|
on: September 08, 2009, 07:29:52 am
|
|
You say:
"I'm not exactly sure how a CCD works, How does this help detect wavelength"
Imagine that the CCD is a long line of light detectors. Imagine you shine a rainbow on the CCD. A part of the CCD will get red light, a part green light and so on. So the intensity of the different parts gives you the intensity of the different colors.
You can get your "rainbow" from a prism or, possibly, a bit of a broken CD or DVD.
|
|
|
|
|
6
|
Forum 2005-2010 (read only) / Interfacing / Re: Using Port C as digital output
|
on: February 04, 2010, 01:07:14 am
|
|
So, I should actually do:
// Turn analog inputs to digital outputs DDRC=0x3F ; // These will be pin numbers 14 .. 19
is that right?
I posted this because I could not find any clear examples of using these pins.
And you say:
"PC0 thru PC5 map to Arduino A0 (14) thru to A5 (19)."
which I understand, but what is the advised way of naming these pins. 14 ... 19. I can't find the C define for "A0" or PC0.
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Interfacing / Using Port C as digital output
|
on: February 03, 2010, 10:14:06 am
|
|
It took me a bit of time to extract this info from the docs and the board itself, so I thought I'd post it here so any searchers in the future will get there quicker.
This is for the Duemilanove
//Using Port C as digital output
In your setup: // Turn analog inputs to digital outputs DDRC=0xFF ; // These will be pin numbers 14 .. 19
In your loop: digitalWrite (14, HIGH); // ...etc... digitalWrite (19, LOW);
|
|
|
|
|
10
|
Forum 2005-2010 (read only) / Interfacing / Re: Ports C D & E
|
on: January 19, 2010, 08:33:25 am
|
|
Thanks for that link, it was just what I wanted.
So, for the Arduino DueMilaNove Port B the lower six bits are available for digital IO Port C the lower six bits are available for digital IO and analog input Port D the upper six bits are available for digital IO
It seems that sometimes the docs say pin0 when they mean bit0...?
|
|
|
|
|
12
|
Forum 2005-2010 (read only) / Interfacing / Ports C D & E
|
on: January 19, 2010, 05:44:10 am
|
|
I think, but I am not sure, that I can use all bits of the three ports as input and output?
Port B has 6 bits Port C has 6 bits Port D has 8 bits
Is that true? I don't need MISO and MOSI etc so presumably those 4 bits become free for me to use in Port B.
Basically my question is, can I use all bits of all three ports as digital IO as long as I configure them properly, or is there some hardware of the Arduino which prohibits this?
|
|
|
|
|
14
|
Forum 2005-2010 (read only) / Interfacing / Tristating port bits connected in parallel
|
on: January 19, 2010, 06:06:46 am
|
|
Imagine a "master" Arduino (M) which is connected to 2 other "slave" Arduinos (SA & SB).
Imagine that 4 bits of all three Arduino's are connected together in parallel. The master M always has its bits as input. And by default the slaves have their bits configured as inputs.
Imagine that one of the two slaves (say slave A) has to send 4 bit data to the master. Can I make slave B's bits configured as input then output the data from slave A?
Ignore the problem of having two slaves outputting at the same time, that would never happen for mechanical reasons.
|
|
|
|
|
15
|
Forum 2005-2010 (read only) / Interfacing / 5V in direct?
|
on: September 15, 2009, 09:01:12 am
|
|
From "Getting started with the Arduino" I'm not sure if I can supply my own 5V supply direct to the 5V pin, or whether I should always use the 9V to the 9V in pin?
I ask this because I already have a 5V supply available, and it seems a waste to supply 9V to be reduced to 5.
|
|
|
|
|