Skip to content

Commit e39a8cc

Browse files
author
Stefania
authored
Merge pull request #30 from robsoncouto/patch-25
Translated file for shiftOut() function
2 parents ffc8ae0 + b23eff7 commit e39a8cc

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

Language/Functions/Advanced IO/shiftOut.adoc

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: shiftOut()
33
categories: [ "Functions" ]
4-
subCategories: [ "Advanced I/O" ]
4+
subCategories: [ "Entradas e Saídas Avançadas" ]
55
---
66

77
:source-highlighter: pygments
@@ -17,34 +17,33 @@ subCategories: [ "Advanced I/O" ]
1717
--
1818

1919
[float]
20-
=== Description
21-
Shifts out a byte of data one bit at a time. Starts from either the most (i.e. the leftmost) or least (rightmost) significant bit. Each bit is written in turn to a data pin, after which a clock pin is pulsed (taken high, then low) to indicate that the bit is available.
20+
=== Descrição
21+
Transfere um byte de dados um bit de cada vez. Começa com ou o bit mais significante (o mais à esquerda) ou o menos significante (mais à direita). Cada bit é escrito em sequência em um pino _data_, logo após o pino _clock_ é pulsado (colocado em HIGH, depois LOW) para indicar que aquele bit está disponível.
2222

23-
Note- if you're interfacing with a device that's clocked by rising edges, you'll need to make sure that the clock pin is low before the call to `shiftOut()`, e.g. with a call to `digitalWrite(clockPin, LOW)`.
23+
Nota - se você está conectando um dispositivo que é sincronizado pela borda de subida do clock, irá precisar fazer com que o pino clock seja low antes de chamar `shiftOut()`, ex. com `digitalWrite(clockPin, LOW)`.
2424

25-
This is a software implementation; see also the link:../SPI[SPI library], which provides a hardware implementation that is faster but works only on specific pins.
25+
Essa é uma implementação por software; O Arduino também provê uma link:../SPI[biblioteca SPI] que faz a implementação em hardware, que é mais rápida, mas apenas funciona em pinos específicos.
2626
[%hardbreaks]
2727

2828

2929
[float]
30-
=== Syntax
30+
=== Sintaxe
3131
`shiftOut(dataPin, clockPin, bitOrder, value)`
3232

3333

3434
[float]
35-
=== Parameters
36-
`dataPin`: the pin on which to output each bit (int)
35+
=== Parâmetros
36+
`dataPin`: o pino no qual transferir cada bit (int)
3737

38-
`clockPin`: the pin to toggle once the dataPin has been set to the correct value (int)
38+
`clockPin`: o pino a ser pulsado uma vez que o pino data estiver com o bit a ser trasnferido (int)
3939

40-
`bitOrder`: which order to shift out the bits; either MSBFIRST or LSBFIRST.
41-
(Most Significant Bit First, or, Least Significant Bit First)
40+
`bitOrder`: em que ordem receber os bits; pode ser *MSBFIRST* ou *LSBFIRST*. Respectivamente, primeiro o bit mais significativo (Most Significant Bit First), ou o primeiro o bit menos significativo (Least Significant Bit First)
4241

43-
`value`: the data to shift out. (byte)
42+
`value`: o valor a ser transferido. (byte)
4443

4544
[float]
46-
=== Returns
47-
Nothing
45+
=== Retorna
46+
Nada
4847

4948
--
5049
// OVERVIEW SECTION ENDS
@@ -57,9 +56,9 @@ Nothing
5756
--
5857

5958
[float]
60-
=== Example Code
59+
=== Código de Exemplo
6160
// Describe what the example code is all about and add relevant code ►►►►► THIS SECTION IS MANDATORY ◄◄◄◄◄
62-
For accompanying circuit, see the http://arduino.cc/en/Tutorial/ShiftOut[tutorial on controlling a 74HC595 shift register].
61+
Para o circuito, ver o http://arduino.cc/en/Tutorial/ShiftOut[tutorial sobre o controle de um registrador de deslocamento 74HC595 (Em Inglês)].
6362

6463
[source,arduino]
6564
----
@@ -72,28 +71,31 @@ For accompanying circuit, see the http://arduino.cc/en/Tutorial/ShiftOut[tutoria
7271
// : to count from 0 to 255 //
7372
//****************************************************************
7473
75-
//Pin connected to ST_CP of 74HC595
74+
//Pino conectado a ST_CP no 74HC595
7675
int latchPin = 8;
77-
//Pin connected to SH_CP of 74HC595
76+
//Pino conectado a SH_CP no 74HC595
7877
int clockPin = 12;
79-
////Pin connected to DS of 74HC595
78+
//Pino conectado a DS no 74HC595
8079
int dataPin = 11;
8180
8281
void setup() {
83-
//set pins to output because they are addressed in the main loop
82+
//configura os pinos usados no loop principal como saídas
8483
pinMode(latchPin, OUTPUT);
8584
pinMode(clockPin, OUTPUT);
8685
pinMode(dataPin, OUTPUT);
8786
}
8887
8988
void loop() {
90-
//count up routine
89+
//rotina de contagem de 0 até 255
9190
for (int j = 0; j < 256; j++) {
92-
//ground latchPin and hold low for as long as you are transmitting
91+
//coloca e mantém o pino latch em low enquanto ocorre a transmissão
9392
digitalWrite(latchPin, LOW);
93+
94+
//transmite o valor de j, a começar pelo bit menos significativo
9495
shiftOut(dataPin, clockPin, LSBFIRST, j);
95-
//return the latch pin high to signal chip that it
96-
//no longer needs to listen for information
96+
97+
//retorna o pino latch para high para sinalizar ao chip
98+
//que esse não precisa mais esperar por informação
9799
digitalWrite(latchPin, HIGH);
98100
delay(1000);
99101
}
@@ -102,24 +104,24 @@ void loop() {
102104
[%hardbreaks]
103105

104106
[float]
105-
=== Notes and Warnings
106-
The dataPin and clockPin must already be configured as outputs by a call to link:../digital-io/pinMode[pinMode()].
107+
=== Notas e Advertências
108+
Os pinos data e clock devem ser configurados como saídas com uma chamada de link:../digital-io/pinMode[pinMode()].
107109

108-
shiftOut is currently written to output 1 byte (8 bits) so it requires a two step operation to output values larger than 255.
110+
A função `shiftOut()` atualmente funciona para transferir apenas 1 byte (8 bits) então requer uma operação em dois passos para transferir valores maiores que 255.
109111
[source,arduino]
110112
----
111-
// Do this for MSBFIRST serial
113+
// Para serial MSBFIRST, faça:
112114
int data = 500;
113-
// shift out highbyte
115+
// transfere o byte mais significativo
114116
shiftOut(dataPin, clock, MSBFIRST, (data >> 8));
115-
// shift out lowbyte
117+
// trasnfere o byte menos significativo
116118
shiftOut(dataPin, clock, MSBFIRST, data);
117119
118-
// Or do this for LSBFIRST serial
120+
// Para serial LSBFIRST, faça:
119121
data = 500;
120-
// shift out lowbyte
122+
// transfere o byte menos significativo
121123
shiftOut(dataPin, clock, LSBFIRST, data);
122-
// shift out highbyte
124+
// transfere o byte mais significativo
123125
shiftOut(dataPin, clock, LSBFIRST, (data >> 8));
124126
----
125127
[%hardbreaks]

0 commit comments

Comments
 (0)