NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » Turning pins off
April 20, 2012 by SirThorfinn |
Hi, So I know how to tell the micro-controller to turn pins on and set then to High and to ground but how do you turn the pin completely off mid code after being on initially? |
---|---|
April 20, 2012 by Ralphxyz |
And what exactly is your question? If you know how to set a pin to High and to ground I think you know how to turn a pin on and off! Ralph |
April 20, 2012 by dgikuljot |
@Ralphxyz I think like alot of begginers he thinks he can turn a pin completly off and not have it be A High or Low with code. @Sirthorfinn, The pin has to be either High or Low when it is being used. It cant just be neither aka Floating. Lots of begginers including me usually think the pin could either be completly off, low or high but in reality the pin is either high or low. So if you have something connected to a pin that operates when the pin is High, then when you need that item off you will set that pin to low. |
April 20, 2012 by SirThorfinn |
I am fairly new but let me explain why I am asking this. The thing i want to get working is a 8-bit Serial-in, Parallel-Out Shift register 74HC595N. I am trying to understand the Datasheet to help me implement this with the micro-controller. (The data sheet is here: "http://www.sparkfun.com/datasheets/IC/SN74HC595.pdf" if you'd like to look)I have the microcontroller hooked up to all the essential pins on the actual register. On page 2 it has a chart showing what inputs do what and how to shift pins in and out includeing clearing the regiter. But what im haveing trouble with is knowing what its saying, i understand "H" as high and "L" low and my thoughts were the "X" was no current what so ever but i guess thats wrong and i dont know what the arrow means either. Could you help me figure out how to set this up? I probably should have just said this in the first place but i didn't really know what my problem was, lol. Thanks, Thorfinn |
April 20, 2012 by Pew446 |
Can't you just turn the pin to the Input state? |
April 20, 2012 by pcbolt |
SirThorfinn - I was just using a parallel in/ serial out register and it had similar notation. The 'X' does not correspond to any electrical state of the pin. It simply means the pin can be high or low, or as one datasheet said "don't care". In other words, pins marked with an 'X' are not taken into consideration for the particular function in the function table. |
April 21, 2012 by Rick_S |
Dang pcbolt, You jump in there all the time anymore and beat me to the draw What pcbolt said is exactly right. The X's mean the chip doesn't care if that pin is high or low for that given function. Also, what Pew446 said is very close to explaining how to make a pin "float" The NK guys do this in their LED Array project where they need pins to go into a Tri-state(Hi-Z) mode. Let's say you wanted to Tri-state PB5. To do this, you not only have to have the pin in input mode -- DDRB &= ~(1<<PB5), you also have to have the pullup turned off for that port -- PORTB &= ~(1<<PB5). This will put the pin in a high impedance (Tri-state) mode. One last thing, there is sample code all over this forum for driving 74HC595's. I've posted code Here showing the use via the SPI bus on the micro and Here is a source file from my blog showing the use of a shift array (similar to the '595) driven by bit banging. Either way, shift array's are fun to play with and can add a lot of versatility. They are great for driving 7 segment displays. Rick |
April 21, 2012 by SirThorfinn |
Thank you all. I get it now, the datasheet didn't have a symbol key so i didnt know what it was saying. I'll check that stuff out and see if i can get a better idea how to work it. I'm still unsure what the arrow means in the chart though, do you know what that means? |
April 21, 2012 by Rick_S |
The arrows represent at what point of the clock pulse the action takes place. If it takes place on the rise of the pulse (Low to High transition) they show the up arrow, or if it takes place on the drop of the pulse (High to Low transition) they show the down arrow. Rick |
April 21, 2012 by SirThorfinn |
Thank you, I understand it all now. thanks for the help |
Please log in to post a reply.
Did you know that many systems in nature can be described by a first order response? Learn more...
|