Basic Stamp -- ShiftIn and ShiftOut
Hello everybody,
I have to communicate the BS II with a device using a Serial
Sincronous Protocol. The device receives and sends data using this parameters:
1) All transmissions are 8bits LSB 2) The logic level on the data lines is
changed by the transmitting device on the falling edge of the clock. This is
then read by the receiving device on the leading edge allowing time for the
signal to settle.
I think I can't do this with ShiftIn and ShiftOut because I don't
find any appropiate MODE. Perhaps, I need to use a For...Next loop (like in the
BS I), but I don't know how. Can anybody help me with this?
Thank you very much,
Ezequiel
[noparse][[/noparse]Non-text portions of this message have been removed]
I have to communicate the BS II with a device using a Serial
Sincronous Protocol. The device receives and sends data using this parameters:
1) All transmissions are 8bits LSB 2) The logic level on the data lines is
changed by the transmitting device on the falling edge of the clock. This is
then read by the receiving device on the leading edge allowing time for the
signal to settle.
I think I can't do this with ShiftIn and ShiftOut because I don't
find any appropiate MODE. Perhaps, I need to use a For...Next loop (like in the
BS I), but I don't know how. Can anybody help me with this?
Thank you very much,
Ezequiel
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
writes:
> I think I can't do this with ShiftIn and ShiftOut because I don't find
> any appropiate MODE. Perhaps, I need to use a For...Next loop (like in the
> BS I), but I don't know how. Can anybody help me with this?
>
Are you talking about the baud rate ?
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
SHIFTOUT DataPin, ClockPin, LSBFIRST, [noparse][[/noparse] data, data, data, ... ]
The data pin is setup and the clock pulse goes high and returns low while the
data bit is in place -- this works for all devices that we know off.
For SHIFTIN, you should be able to get it to work with this:
SHIFTIN DataPin, ClockPin, LSBPOST, [noparse][[/noparse] data ]
LSBPOST samples the data after the clock pulse has dropped.
Before your resort to a code loop, perhaps you could share what device you're
using ... there is a lot of experience in this group and perhaps someone has
solved the issue for your particular device.
One last thing: If the device data pin is bi-directional, you should connect
to the Stamp using a 1K resistor so that in the even that the Stamp data pin
and the device data pin are both outputs and of opposite state (one high, one
low), there will be no short circuit.
-- Jon Williams
-- Applications Engineer, Parallax
In a message dated 7/30/02 7:48:58 AM Central Daylight Time, nik@i...
writes:
> Hello everybody,
> I have to communicate the BS II with a device using a Serial
> Sincronous Protocol. The device receives and sends data using this
> parameters: 1) All transmissions are 8bits LSB 2) The logic level on the
> data lines is changed by the transmitting device on the falling edge of the
> clock. This is then read by the receiving device on the leading edge
> allowing time for the signal to settle.
> I think I can't do this with ShiftIn and ShiftOut because I
> don't find any appropiate MODE. Perhaps, I need to use a For...Next loop
> (like in the BS I), but I don't know how. Can anybody help me with this?
>
> Thank you very much,
>
>
[noparse][[/noparse]Non-text portions of this message have been removed]
Thank you very much. I have a clock pin (The Stamp sends the Clock)
and two more pin, Data and Command. The Device sends 2 bytes via the Data
Pin. And the Stamp sends 2 commands using the Command Pin. It's bi
directional but using differents pins.
Another point, I read in the device datasheet that the Data Output
is Open Drain. Do I have to put some resistors, so the Stamp can "see" the
1s and the 0s that the device transmit?
Thank you very much, Jon and Sid.
Ezequiel
Original Message
From: <jonwms@a...>
To: <basicstamps@yahoogroups.com>
Sent: Tuesday, July 30, 2002 10:09 AM
Subject: Re: [noparse][[/noparse]basicstamps] Basic Stamp -- ShiftIn and ShiftOut
> When using SHIFTOUT, you should be able to set it up as follows:
>
> SHIFTOUT DataPin, ClockPin, LSBFIRST, [noparse][[/noparse] data, data, data, ... ]
>
> The data pin is setup and the clock pulse goes high and returns low while
the
> data bit is in place -- this works for all devices that we know off.
>
> For SHIFTIN, you should be able to get it to work with this:
>
> SHIFTIN DataPin, ClockPin, LSBPOST, [noparse][[/noparse] data ]
>
> LSBPOST samples the data after the clock pulse has dropped.
>
> Before your resort to a code loop, perhaps you could share what device
you're
> using ... there is a lot of experience in this group and perhaps someone
has
> solved the issue for your particular device.
>
> One last thing: If the device data pin is bi-directional, you should
connect
> to the Stamp using a 1K resistor so that in the even that the Stamp data
pin
> and the device data pin are both outputs and of opposite state (one high,
one
> low), there will be no short circuit.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
>
>
> In a message dated 7/30/02 7:48:58 AM Central Daylight Time,
nik@i...
> writes:
>
>
> > Hello everybody,
> > I have to communicate the BS II with a device using a Serial
> > Sincronous Protocol. The device receives and sends data using this
> > parameters: 1) All transmissions are 8bits LSB 2) The logic level on
the
> > data lines is changed by the transmitting device on the falling edge of
the
> > clock. This is then read by the receiving device on the leading edge
> > allowing time for the signal to settle.
> > I think I can't do this with ShiftIn and ShiftOut because I
> > don't find any appropiate MODE. Perhaps, I need to use a For...Next loop
> > (like in the BS I), but I don't know how. Can anybody help me with this?
> >
> > Thank you very much,
> >
> >
>
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
through a 4.7K resistor so the Stamp can "see" transitions on it.
BTW ... what is this mystery device?....
-- Jon Williams
-- Applications Engineer, Parallax
In a message dated 7/30/02 10:30:21 AM Central Daylight Time, nik@i...
writes:
> Another point, I read in the device datasheet that the Data Output
> is Open Drain. Do I have to put some resistors, so the Stamp can "see" the
> 1s and the 0s that the device transmit?
>
[noparse][[/noparse]Non-text portions of this message have been removed]
Well, the mistery device is an "intelligent Joypad" made by Sony
Electronic, which has 14 buttons and only 4 lines (clock, data,cmd and att),
so it's a good keypad for most proyect where you run out of pin (a keypad of
12 buttons will use 7 lines vs 14 buttons and 4 lines). Some days ago I
posted a message about a Sony Controller (the Joypad of the PlayStation 1).
As nobody replied to my message, I decided to ask a friend a book about
digital eletronic. Using a few time diagrams (which I posted here) and the
book, I wrote a program to interfase the Joypad using only a few
instrucction (High, Low and Pause). But the program didn't work. Then I
looked at the BS II manual and I saw the ShiftIn and ShiftOut instrucction.
But the program didn't work too. I though about using PicBasic Pro and a PIC
(because PicBasic Pro has more ShiftIn and ShiftOut modes, I think it has 8
for each one) but I didn't work.
Now I looked at the datasheet of the Controller and it says that there
is a ACK (Acknowledge) pin. The signal goes low for 60uSeg and the return
high if the command was received OK. But the program doesn't work. And I'm
going crazy, because I really need this interfase working. The Joypad works
with my PC (it's connected to my Parallel Port, and the dirver is programmed
in C, but I don't undertad C), so in theory I has to work with the Stamp or
any microcontroller.
Anyway, thanks you and the Stampers very much for your help and time. I
couldn't make the interfase work (now), but at least I understood how
ShiftIn and ShiftOut work. Thank you very much, again.
P.D.: What does it means "BTW"?
Ezequiel
Buenos Aires, Argentina.
Carlos Contreras
presidente Club Cientifico de Pe
Te aseguro que no es I2C, porque en los diagramas de tiempo no
hay ninguna condicion de Start, Stop, y lo reconoceria facilmente, ya que
utilizo mucho memorias seriales I2C.
Ezequiel Aceto
> Hello Jon and Stampers,
> Well, the mistery device is an "intelligent
> Joypad" made by Sony
> Electronic, which has 14 buttons and only 4 lines
> (clock, data,cmd and att),
Hello Ezequiel,
It looks like you and I have something in common,
in that we're both trying to interface a Stamp toa
serial device with little or not data available on the
device. In my case I literally have none. The device
I am trying to use is a Digital Keypad used in some
Radio Shack alarm systems. The device communicates
over a serial bus (2-wire?), but I have yet to find
ANY specs on this thing ANYWHERE on the internet.
Here's where I could use a good storage
scope...Anyway, let me know if you successfully get
yours working, and I suspect it would be a similar
design for N64 controllers and their memory packs.
Chris Savage/Knight Designs
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com