Project 15 – Interface with SKPS

PROJECT 15

INTERFACE WITH SKPS

Back to Project 14                                                                                                    Go to Project 16

Play Station 2 (PS2) controller is relatively easy to obtain from any game store and it offers good human manual input for control system. More and more developers are looking into applying existing PS2 controller to control particular system. In here, we going to explore on how to interface PS2 controller with SK40C through SKPS controller starter kit.

———————————————————————————————————————————————————-

COMPONENT NEEDED

———————————————————————————————————————————————————-

16 x 2 LCD DISPLAY
 SKPS CONTROLLER STARTER KIT
 SONY PS2 CONTROLLER
 JUMPER WIRES

———————————————————————————————————————————————————-

CONNECTION

———————————————————————————————————————————————————-
Connection between SKPS and SK40C are only required 4 wires which is power in(VDD), ground(GND), transmit(TX), receive(RX). RED wire are VDD which connected from VDD of SK40C to 5V of SKPS. BLACK wire are GND which is connected from GND of SK40C to GND of SKPS. GREEN wire are transmit(TX) from SK40C to receive(RX) of SKPS. YELLOW wire are receive(RX) from SK40C connected to transmit(TX) of SKPS. Please refer SKPS user manual for detail.

———————————————————————————————————————————————————-

ADDITIONAL INFORMATION

———————————————————————————————————————————————————-
The major problem of PS2 Controller is to achieve this is the socket for PS2 and the protocol to communicate with it. PS2 socket is very unique and difficult to obtain. Besides, protocol to obtain the status (digital and analog) of each button and analog stick on PS2 controller create headache to developer. Thus, using SKPS starter kit, it offers a compact yet reliable PS2 Controller Converter for user. SKPS’s power and UART pin is compatible with SKKCA and SKXBee. A host is needed to communicate with SKPS through UART. It offers a standard connector for Sony PS2 controller to plug-in.

Features

~ Stable 5V powered, low current consumption, less than 150mA.
~ 1 standard PS2 controller socket.
~ Communicate with host microcontroller through 5V TTL UART.
~ Simple inquiry command and button status feedback for host to process.
~ Vibrator motor is controllable.
~ Wired or wireless PS2 controller is fully compatible.
~ PS2 Controller will only operate in analog mode.
~ A small LED as indicator for communication between SKPS and PS2 controller.

———————————————————————————————————————————————————-

CODE OVERVIEW

———————————————————————————————————————————————————-
SKPS

unsigned char uc_skps(unsigned char uc_data)
Receive uc_data from main program to requrest and check the I/O port of the PS2 controller. After that, return the result back to main program.

uart_transmit(uc_data);
Send out the uc_data to SKPS to check or request the status of PS2 controller using serial communication (UART).

return uc_uart_receive();
Send back the result received from SKPS to main program.

void skps_vibrate(unsigned char uc_motor, unsigned char uc_value)
Send signal to PS2 controller to vibrate the motor inside. uc_motor is to select motor_1 or motor_2. uc_value is to select the motor speed. For motor_1, the speed are already fix while for motor_2, we can control the motor speed.

MAIN PROGRAM

uc_skps(no);
Request the data output from PS2 by sending the request signal to SKPS and it will check the requested push button of PS2 whether it is been pressed.

case_num = no;
Select the case needed. If SKPS have detected the push button of PS2 is pressed, case_num will select the case number same as the data sent then display on LCD for that which button we have pressed.

display();
Select display() subroutine.

no = 0;
Reset the no back to 0.


Check the LEFT joystick if it is press by OR all the LEFT joystick to see if there is an output value. If is pressed, select case 16, then loop forever and store data in data[ ] then display the data[ ] value on LCD and ON motor_2. If not then clear LCD and stop the motor_2 vibrate.


Select the case by referring to the case_num and display the button pressed on LCD screen.

Back to Project 14                                                                                                    Go to Project 16

———————————————————————————————————————————————————-

ATTACHMENT

1. P15 User Manual.pdf
2. Project_15_code.zip

Buy

, , , ,

Related Post

Control and Monitor via SMS Part 2

Simple steps to control Stepper Motor using 2Amp Motor Driver Shield and CIKU

PIC16F VS PIC18F:Analysis of PIC Mid-Range 8 bit family and Advanced 8-bits Family

SK40C vs CT-UNO

Leave a Reply

Your email address will not be published. Required fields are marked *