Upload
stephanie-ashlynn-mosley
View
227
Download
0
Embed Size (px)
Citation preview
64 CONTROLLERAARON RIDENOUR, RYAN WOOSTER, ALEX JAECKEL
CONTROLLER
Inputs: A, B, L, R, Z, start, C-up C-down, C-left, C-right, D-Pad(up, down, left, right), JoystickOptions: Rumble Pak, Memory Pak
http://conker.wikia.com/wiki/Nintendo_64_Controller
http://electronics.howstuffworks.com/n643.htm
ACTION BUTTONS
• Each buttons sits atop a metal plate.
• When the button is pressed, the metal plate contacts two strips of conductive material attached to the circuit board, creating a current.
• The controller senses this current, and sends a logical 1 if the button is pressed, and a logical 0 if the button is not pressed.
http://electronics.howstuffworks.com/n643.htm
JOYSTICK
• Two wheels positioned at right angles to each other, one for the x-axis, one for the y-axis.
http://electronics.howstuffworks.com/n643.htmhttp://electronics.howstuffworks.com/n643.htm
JOYSTICK
• Incremental Encoding• Each wheel has slits
around the perimeter• Controller counts how
many times the light sensors see the LED through the slits, and uses that to determine position.• One wheel for each axis.
http://www.eecs.umich.edu/courses/eecs461/lecture/Lecture3.pdf
JOYSTICK
The controller knows which way the joystick is moving by looking at which sensor sees the LED first.
http://en.wikipedia.org/wiki/File:Quadrature_Diagram.svg
CONNECTION TO N64
http://afermiano.com/index.php/n64-controller-protocol
• Vcc = 3.3V
• Data line is bidirectional
• A pull up-resistor is needed to read the line
OPEN COLLECTOR
• Pull-up resistor keeps the line high while idle.
• To send 0, the output line is pulled low and connected to ground.• To send 1, nothing should be
sent.• Do not drive the line high.
http://www-inst.eecs.berkeley.edu/~cs150/fa04/Lab/Checkpoint1.PDF
OPEN COLLECTOR
Sending a logical 0:
http://www-inst.eecs.berkeley.edu/~cs150/fa04/Lab/Checkpoint1.PDF
00
1
1
OPEN COLLECTOR
Sending a logical 1:
http://www-inst.eecs.berkeley.edu/~cs150/fa04/Lab/Checkpoint1.PDF
1 1
0
1
CONTROLLER ENCODING
Each bit is sent in 4 Logical 0:
Logical 1:
Low for 3 , followed by high for 1
Low for 1 , followed by high for 3
http://www.pieter-jan.com/node/10
http://www.pieter-jan.com/node/10
CONTROLLER ENCODING
http://inst.eecs.berkeley.edu/~cs150/sp01/Labs/lablecckpt1.ppt
COMMUNICATION PROTOCOL
When a Command byte is sent to the controller, it sends a response depending on which command was sent.
Check Controller Command: 0x00• The controller responds with 3 bytes. The first
two bytes are always 0x0500• Last byte is determined by:• 0x01: If a controller pack is connected.• 0x02: If no controller pack is connected.• 0x04: If a previous command resulted in an
error.
Reset Controller Command: 0xFF• First resets the controller, including
resetting the joystick calibration• Controller then responds as in the
Check Controller Command
COMMUNICATION PROTOCOL
COMMUNICATION PROTOCOL
Input Polling Command: 0x01
• The controller responds with 4 bytes, encoding the button and joystick values
Byte Data[7]
Data[6]
Data[5]
Data[4]
Data[3]
Data[2]
Data[1]
Data[0]
1 A B Z Start D-Up D-Down
D-Left D-Right
2 Joystick Reset
0 L R C-Up C-Down
C-Left C-Right
3 Signed joystick x-axis coordinate
4 Signed joystick y-axis coordinateThe joystick values range between -128 and 127, but the controller physically can only use from -81 to 81.
EXAMPLE DATA WAVEFORM
|----Command (console) 0x01-----|
|----Data1 (controller) 0x00----|
|-----Data2 (controller) 0x00----|
|--------Data3 (controller) 0x00----------|
|---------Data4 (controller) 0x01---------|
A B Z St
rese
t
0 L R
Joystick x-coordinate
Joystick y-coordinate
start
bit
stop
bit
stop
bit
Images taken from: http://afermiano.com/index.php/n64-controller-protocol
COMMUNICATION PROTOCOL
Controller Pack Read: 0x02
•Used to read from the controller pack.
•The command is followed by 2 bytes which indicate the address being read from and a CRC to verify the address.
•The controller responds with 32 bytes of data from that address, followed by the data CRC.
Controller Pack Write: 0x03
•Used to write to the controller pack.
•The command is followed by 2 bytes which indicate the address being written to, a CRC to verify the address and the 32 bytes of data to write.
•The controller responds with the data CRC.
COMMUNICATION PROTOCOL
COMMUNICATION PROTOCOL
CRC:
•Used to verify that data was sent correctly.
•Outside scope of this presentation.
https://code.google.com/p/micro-64-controller/wiki/CRC
RUMBLE PAK
•Use the 0x03 command.
• To initialize:
• Send to address 0x8001.
• Send 0x80 (repeated 34 times) as the data.
• To run the Rumble Pak:
• Send to address 0xc01b.
• Send 0x01 (repeated 32 times) as the data to start the Pak.
• Send 0x00 (repeated 32 times) as the data to stop the Pak.
http://upload.wikimedia.org/wikipedia/commons/3/34/N64-Rumble-Pak.jpg
REFERENCES
• http://www.pieter-jan.com/node/10
• http://afermiano.com/index.php/n64-controller-protocol
• https://code.google.com/p/micro-64-controller/wiki/Protocol
• http://www-inst.eecs.berkeley.edu/~cs150/fa04/Lab/Checkpoint1.PDF
• http://www.mixdown.ca/n64dev/
• http://svn.navi.cx/misc/trunk/wasabi/devices/cube64/firmware/n64gc_comm.inc