itÜ computer engineering interconnection protocols project presentation ersan Öztürk-504041515...
TRANSCRIPT
iTÜ COMPUTER ENGINEERING INTERCONNECTION PROTOCOLS
PROJECT PRESENTATION Ersan Öztürk-504041515
26/12/2005
JAVA RADIO
Java Radio
Ersan ÖztürkOUTLINE
•Idea
•Aim
•Radio Chip: TEA5764
•I2C
•Parallel Port
•Hardware Connection
•OSI layers: physical, logical link
•JNI
•To do list
•Problems encountered
•Conclusion
Java Radio
Ersan ÖztürkIDEA
•Cell phones that does not have radio on
•64% of cell phones support Java applications.*
•People request music everytime, everywhere
*Source:GFK
Java Radio
Ersan ÖztürkAIM
•IO control of the phones requires longer time,
•So aim is:
Radio control via a PC using JavaTM language
•A radio that can be controlled via PC:
TEA5764
•Can be controlled via I2C
Java Radio
Ersan ÖztürkRadio Chip:TEA5764
•Chip produced by Philips,
•One of the smallest radio chips
•It supports Radio Display System (RDS)
RDS: station, song, artist display
•Control can be done via I2C
•Consumes low power
Java Radio
Ersan ÖztürkI2C - definition
•Inter Integrated Circuit
•Syncronious Serial Communication
LOW COST
COMPLEXITY
SPEED
•Developed by Philips semiconductors in 1980’s
•Used to control signal processing devices such as:RF tuners, video decoders,audio processors, EEPROMS, real time clocks etc.
Java Radio
Ersan ÖztürkI2C - Basics
Two lines: bidirectional communitaction
Dev. 2
Slave
Dev. 1
Master
SDA:Serial Data
SCL:Serial Clock
•Intiates and finishes communication
•Establishes syncronization by clock
•Determines data direction
•Responds when addressed, at the time given by master
Java Radio
Ersan ÖztürkI2C – Communication1
SEND / WRITE
START address R/W A_S Byte1 A_S ..... A_S STOP
0010000 0 XXXXXXXX
....
START address R/W A_S Byte1 A_M ..... NAMSTOP
0010000 0 XXXXXXXX
RECEIVE / READ
A_S: Acknowledge by slave
A_M:Acknowledge by master
NAM:Non Acknowledge by master
Java Radio
Ersan ÖztürkI2C – Communication2
START
STOP
ACK_MASTER
ACK_SLAVE
NON_ACK_MASTER
SCL:HIGH
SDA:HIGH > LOW
SDA:LOW > HIGH
SCL:HIGH
SCL:PULSE
SDA:LOW BY MAS.
SDA:LOW BY SLA.
SCL:PULSE
SDA:HIGH BY MAS.
SCL:PULSE
Java Radio
Ersan ÖztürkParallel Port - 1
•8 pins are bidirecitional used for data accessed via DATA PORT
•5 pins are input accessed via STATUS PORT
(one is inverted)
•4 pins are output accesses via CONTROL PORT (three are inverted)
•Remaining pins are Grounded
Java Radio
Ersan ÖztürkParallel Port - 2
D7
D6
D5
D4
D3
D2
D1
D0
D7
D6
D5
D4
D3
D2
D1
D0
D7
D6
D5
D4
D3
D2
D1
D0
DATA7
DATA6
DATA5
DATA4
DATA3
DATA2
DATA1
DATA0
IRQ
~ERROR
SELECT
PE
~ACK
BUSY
RESERVED
RESERVED
RESERVED
RESERVED
IRQENABLE
~SELECTIN
INIT
~AUTOFEED
~STROBE
DIRECTION
DATA (378|278|3BC) STATUS (DATA+1) CONTROL (DATA+2)
Windows NT,2000 and XP does not let user programs to reach memory addesses. Windows 98,ME let it!
Java Radio
Ersan ÖztürkHardware Connection
TEA5764SCL
PIN2
PIN16 SDA
GNDPIN18-25
PIN2: DATA PORT 0
PIN16:CONTROL PORT 2
PARALLEL PORT
VCC VDD VREFDIG
SPEAKER
Java Radio
Ersan ÖztürkCoding – Physical Layer
void Zero()
{
SDA(LOW);
delay (DELAY_MILIS,DELAY_NANOS);
SCL(HIGH);
delay (DELAY_MILIS,DELAY_NANOS);
SCL(LOW);
delay (DELAY_MILIS,DELAY_NANOS);
}
void One()
{
SDA(HIGH);
delay (DELAY_MILIS,DELAY_NANOS);
SCL(HIGH);
delay (DELAY_MILIS,DELAY_NANOS);
SCL(LOW);
delay (DELAY_MILIS,DELAY_NANOS);
} void SDA(int state)
{
if(state==0) lpt1.write_data (0x0000);
else lpt1.write_data (0x0001);
}
Java Radio
Ersan ÖztürkCoding – Network & Procol Layer
void radio_power(int onoff){
FMWrite();
if(ack_slave()==0)
writebyte(0x00ff); // byte0W
if(ack_slave()==0)
writebyte(0x002f); // byte1W : 00101111
if(ack_slave()==0) // 100.0 mhz
writebyte(0x00ca); // byte2W : 11011010
if(ack_slave()==0)
if(onoff==1)
writebyte(0x0040); // byte3W : 01000000
else
writebyte(0x0000); // byte3W : 00000000
if(ack_slave()==0)
Stop();
}
Java Radio
Ersan ÖztürkJava Native Interface (JNI)
A framework that enables Java codes to call native applications and libraries of languages such as C, C++ and assembly
It is mostly used for operating system and hardware related functions
Java Radio
Ersan ÖztürkJNI - Parport
import parport.ParallelPort;
class SimpleIO {
public static void main ( String []args )
{
ParallelPort lpt1 = new ParallelPort(0x378);
int aByte;
aByte = lpt1.read(); // read a byte from the port's STATUS pins
aByte = aByte >> 2; // a simple and irrelevant operation
lpt1.write(aByte); // write a byte to the port's DATA pins
System.out.println("Output to port: " + aByte);
}
}
Java Radio
lpt1.read_data()
In C language
inportb(DATA)
Java Radio
lpt1.write_data(aByte)
In C language
outportb(DATA,aByte)
Java Radio
Ersan ÖztürkHuman Interface
Java Radio
Ersan ÖztürkOutput – via Logic Analyzer
Java Radio
Ersan ÖztürkProblems Encountered
P1)Unsigned bytes are not avaliable in Java
S1)Integers were used instead of bytes
P2)Win XP not allow to reach parallel port
S2)Userport and DirectIO used then Win98 is used
P3)Java Comm is not flexible enough
S3)JNI is used,
P4)Data port used as unidirectional
S4)Parallel Port is set to Enhanced Parallel Port (EPP) from BIOS and direction selection is used on Control Port
P5)Can not get output from radio
S5)Still working on it!!!
Java Radio
Ersan ÖztürkTo do list
•Finish the code and test functions in details
•Establish RDS
•Implement the code in mobile phone emulators
•Differenciate code according to different mobile phone IOs and Java supports
•Marketing the radio to manufacturers nationwide
•Marketing the radio worldwide
•Make money$
Java Radio
Ersan ÖztürkConclusion
Project taught:
•One of the basic interconnection protocols I2C
•One of the basic connection components of PC: The Parallel Port
•Control mechanisms of chips
•Use of Java in low level (JNI)
At the end it can be a success in business.