introductio1.docx

40
INTRODUCTION Conventionally, wireless –controlled robots use RF circuits, which have the drawbacks of limited working range, limited frequency range and limited control. Use of mobile phone for robotic control can overcome these limitations. It provides the advantage of robust control, working range as larger as the coverage area of the service provider, no interference with the other controllers. Although the appearance of and capabilities of robots vary vastly, all robots share the features of mechanical, movable structure under some form of control. In this project, the robot is controlled by a mobile phone attached to the robot. In the course of a cell if any button is pressed, a tone corresponding to the button pressed is heard at other end of a call. This tone called Deal-Tone Multi Frequency. The robot perceives this DTMF tone with the help of the phone stacked in the robot. The received signal is processed by the 89C52 microcontroller with the help of DTMF

Upload: sinu66

Post on 02-Nov-2014

23 views

Category:

Documents


3 download

DESCRIPTION

laser

TRANSCRIPT

Page 1: INTRODUCTIO1.docx

INTRODUCTION

Conventionally, wireless –controlled robots use RF circuits, which have the drawbacks of limited working range, limited frequency range and limited control.

Use of mobile phone for robotic control can overcome these limitations. It provides the advantage of robust control, working range as larger as the coverage area of the service provider, no interference with the other controllers. Although the appearance of and capabilities of robots vary vastly, all robots share the features of mechanical, movable structure under some form of control.

In this project, the robot is controlled by a mobile phone attached to the robot. In the course of a cell if any button is pressed, a tone corresponding to the button pressed is heard at other end of a call. This tone called Deal-Tone Multi Frequency.

The robot perceives this DTMF tone with the help of the phone stacked in the robot. The received signal is processed by the 89C52 microcontroller with the help of DTMF encoder. The decoder decodes the DTMF signal into the digits and this binary number I sent to the microcontroller. The microcontroller is programmed to take a decision for any given input and outputs its decision to the motor drivers in order to drive the motors for forward or backward motion or turn and also to turn the camera. The camera sends the video signal to the user end. So the user can view and control the robot remotely.

Page 2: INTRODUCTIO1.docx

The mobile that makes a call to the mobile phone staked in the robot acts as a remote. DTMF signaling. DTMF signaling is used for telephone signaling over the line in the voice-frequency band to the call switching center. DTMF assigns a specific frequency (Consisting of two separated tones) to each key so that it can easily be identified by the electronic circuit.

Page 3: INTRODUCTIO1.docx

BLOCK DIAGRAM

Page 4: INTRODUCTIO1.docx
Page 5: INTRODUCTIO1.docx

DESCRIPTION

DTMF

DTMF is a signalling system for identifying the keys or better say the number dialled on

a pushbutton or DTMF keypad. The early telephone systems used pulse dialling or loop

disconnect signalling. This was replaced by multi frequency (MF) dialling. DTMF is a multi

frequency tone dialling system used by the push button keypads in telephone and mobile sets to

convey the number or key dialled by the caller. DTMF has enabled the long distance signalling of

dialled numbers in voice frequency range over telephone lines. This has eliminated the need of

telecom operator between the caller and the callee and evolved automated dialling in the telephone

switching centres.

DTMF (Dual tone multi frequency) as the name suggests uses a combination of two sine wave

tones to represent a key. These tones are called row and column frequencies as they correspond

to the layout of a telephone keypad.

Multifrequency signaling

Prior to the development of DTMF, numbers were dialed on automated telephone systems by

means of pulse dialing (Dial Pulse or DP in the U.S.) or loop disconnect (LD) signaling, which

functions by rapidly disconnecting and re-connecting the calling party's telephone line, similar to

flicking a light switch on and off. The repeated interruptions of the line, as the dial spins, sounds like

Page 6: INTRODUCTIO1.docx

a series of clicks. The exchange equipment interprets these dial pulses to determine the dialed

number. Loop disconnect range was restricted by telegraphic distortion and other technical

problems[which?], and placing calls over longer distances required either operator assistance

(operators used an earlier kind of multi-frequency dial) or the provision of subscriber trunk

dialingequipment.

Multi-frequency signaling (see also MF) is a group of signaling methods that use a mixture of

two pure tone (pure sine wave) sounds. Various MF signaling protocols were devised by the Bell

System and CCITT. The earliest of these were for in-band signaling between switching centers,

where long-distance telephone operators used a 16-digit keypad to input the next portion of the

destination telephone number in order to contact the next downstream long-distance telephone

operator. This semi-automated signaling and switching proved successful in both speed and cost

effectiveness. Based on this prior success with using MF by specialists to establish long-

distance telephone calls, Dual-tone multi-frequency (DTMF) signaling was developed for

the consumer to signal their own telephone-call's destination telephone number instead of talking to

a telephone operator.

AT&Ts Compatibility Bulletin No. 105 described the product as "a method for pushbutton signaling

from customer stations using the voice transmission path." In order to prevent consumer telephones

from interfering with the MF-based routing and switching between telephone switching centers,

DTMF's frequencies differ from all of the pre-existing MF signaling protocols between switching

centers: MF/R1, R2, CCS4, CCS5, and others that were later replaced by SS7 digital signaling.

DTMF, as used in push-button telephone tone dialing, was known throughout the Bell System by

the trademark Touch-Tone. This term was first used by AT&T in commerce on July 5, 1960 and

then was introduced to the public on November 18, 1963, when the first push-button telephone was

made available to the public. It was AT&T's registered trademark from September 4, 1962 to March

13, 1984,[2] and is standardized by ITU-T Recommendation Q.23. It is also known in the UK

as MF4.

Other vendors of compatible telephone equipment called the Touch-Tone feature Tone

dialing or DTMF, or used their own registered trade names such as the Digitone of Northern Electric

(now known as Nortel Networks).

The DTMF system uses eight different frequency signals transmitted in pairs to represent 16

different numbers, symbols and letters 

The DTMF keypad is laid out in a 4×4 matrix, with each row representing a low frequency, and each

column representing a high frequency. Pressing a single key (such as '1' ) will send

a sinusoidal tone for each of the two frequencies (697 and 1209 hertz (Hz)). The original keypads

had levers inside, so each button activated two contacts. The multiple tones are the reason for

calling the system multifrequency. These tones are then decoded by the switching center to

determine which key was pressed.

DTMF keypad frequencies (with sound clips)

1209 Hz 1336 Hz 1477 Hz 1633 Hz

697 Hz 1 2 3 A

Page 7: INTRODUCTIO1.docx

770 Hz 4 5 6 B

852 Hz 7 8 9 C

941 Hz * 0 # D

DTMF Circuits

Key Tone

Output LogicQ4 Q3 Q2 Q1

1 0 0 0 12 0 0 1 03 0 0 1 14 0 1 0 05 0 1 0 16 0 1 1 07 0 1 1 18 1 0 0 09 1 0 0 10 1 0 1 0* 1 0 1 1# 1 1 0 0A 1 1 0 1B 1 1 1 0C 1 1 1 1D 0 0 0 0

Detection of dial tones is reflected on the bit TOE, while the output Q4, Q3, Q2, Q1 indicate the dial tone that is being detected on the telephony system. A complete table of the decoded digital output for individual dial tone is available in the coming section.

These are the decoder output table for the given dial tone detected. Notice that there are key tone for A B C and D. These are special tone which are normally not found on our telephone. It is a common standard build into the decoder chip.

The circuit is relatively simple and straight forward, and all components can be easily found.

Page 8: INTRODUCTIO1.docx

ps

7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.

Page 9: INTRODUCTIO1.docx

The 7805 is a linear regulator that takes in DC electricity of at least 7V and outputs a constant 5V. The voltage that is shed (anything over 5V) is converted to heat. You can hook straight up to the three pins on the device without anything extra, but for reliable operation I always add two smoothing capacitors.

These capacitors charge up, and if the current on the input or output dips just a bit, they fill in to keep the power constant. Hence the name smoothing capacitors. For power supplies these are usually electrolytic capacitors because of the traits they supply. The most basic 7805 circuit looks like this:

Page 10: INTRODUCTIO1.docx

CIRCUIT DIAGRAM

R 9

1 0 K

C 2

2 2 pf

U 2

PIC1 6 F8 7 7 A

91 8

1 92 0

2 93 0

31

4 0

1

2

345

67

8

2 12 2

2 3

2 42 52 6

2 72 8

1 0

111213 14

15

1 61 7

3 93 83 73 63 53 43 3

32

R E 1 / A N 6 / W RR C 3 / S C K / S C L

R D 0R D 1

R D 6R D 7

VS

S

R B 7

R E S E T

R A 0 / A N 0

R A 1 / A N 1R A 2 / A N 2R A 3 / A N 3

R A 4R A 5 / A N 4

R E 0 / A N 5 / R D

R D 2R D 3

R C 4 / S D I / S D C

R C 5 / S D OR C 6 / TX

R C 7 / R X

R D 4R D 5

R E 2 / A N 7 / C S

VD

DV

SS

OS

1

OS

2R

C0

R C 1 / C C P 2R C 2 / C C P 1

R B 6R B 5R B 4R B 3R B 2R B 1R B 0 / I N T

VD

D

U 5

M T8 8 7 0

1

23

4

7

8

9

1 01 5

1 6

1 7

18

1 11 21 31 4

V P

V NG S

V R E F

X1

X2 VS

S

O ED V

E S T

R T/ G T

VD

D

D 0D 1D 2D 3

R 1 0R

R 3 1 0 0 K

U 6

L 2 9 3 D

27

1 01 5

19

361 11 4

1684 5 13 12

1 A2 A3 A4 A

1,2

EN

3,4

EN 1 Y

2 Y3 Y4 Y

VC

C1

VC

C2

GN

DG

ND

GN

DG

ND

D 2

L E D

C 4

0 .1 M FD

J 9

1 2 V/2 A DC

12

J 4

M otor3

12

Q 2

3 .5 7 9 M Hz

C 1

10

00

MF

D/2

5V J 5

C O N 2

12

U 8

L 2 9 3 D

27

1 01 5

19

361 11 4

1684 5 13 12

1 A2 A3 A4 A

1,2

EN

3,4

EN 1 Y

2 Y3 Y4 Y

VC

C1

VC

C2

GN

DG

ND

GN

DG

ND

R 1

2 2 0 E

Q 11 2 M Hz

R 4

4 .7 K

D 1

L E D

J 1

M OTOR1

12

J 1 3

M otor2

12

C 60 .0 1 M FD

R 2 3 3 0 K

C 3

2 2 pf

C 5 0 .1 M FD

C 70 .0 1 M FD

J 2

TELE IN

12

U 4

L7 8 0 5

1

2

3V I N

GN

D

V O U T

Page 11: INTRODUCTIO1.docx
Page 12: INTRODUCTIO1.docx
Page 13: INTRODUCTIO1.docx
Page 14: INTRODUCTIO1.docx

PROGRAM

Page 15: INTRODUCTIO1.docx
Page 16: INTRODUCTIO1.docx

APPLICATIONS

ScientificRemote control vehicles have various scientificuses including hazardous environments, working in the deep ocean , and space exploration. The majority of the probes tothe other planets in our solar system have been remotecontrol vehicles, although some of the more recent ones werepartially autonomous. The sophistication of these devices hasfueled greater debate on the need for manned spaceflight andexploration. The Voyager I spacecraft is the first craft of anykind to leave the solar system. The martian explorers Spiritand Opportunity have provided continuous data about thesurface of Mars since January 3, 2004.

Military and Law Enforcement

Military usage of remotely controlled militaryvehicles dates back to the first half of 20th century. Soviet RedArmy used remotely controlled Teletanks during 1930s in theWinter War and early stage of World War II. There were alsoremotely controlled cutters and experimental remotelycontrolled planes in the Red Army.Remote control vehicles are used in law

Page 17: INTRODUCTIO1.docx

enforcement and military engagements for some of the samereasons. The exposure to hazards are mitigated to the personwho operates the vehicle from a location of relative safety.Remote controlled vehicles are used by many policedepartment bomb-squads to defuse or detonate explosives.See Dragon Runner, Military robot.

Unmanned Aerial Vehicles (UAVs) haveundergone a dramatic evolution in capability in the pastdecade. Early UAV's were capable of reconnaissance missionsalone and then only with a limited range. Current UAV's canhover around possible targets until they are positivelyidentified before releasing their payload of weaponry.Backpack sized UAV's will provide ground troops with overthe horizon surveillance capabilities.

Search and RescueUAVs will likely play an increased role in searchand rescue in the United States. Slowly other Europeancountries (even some developing nations) are thinking aboutmaking use of these vehicles in case of natural calamities &emergencies. This can be a great asset to save lives of both people along with soldiers in case of terrorist attacks like the

Page 18: INTRODUCTIO1.docx

one happened in 26 Nov, 2008 in Mumbai, India. The loss ofmilitary personnel can be largely reduced by using theseadvanced methods. This was demonstrated by the successfuluse of UAVs during the 2008 hurricanes that struck Louisianaand Texas.

Recreation and HobbySee Radio-controlled model. Small scale remotecontrol vehicles have long been popular among hobbyists.These remote controlled vehicles span a wide range in termsof price and sophistication. There are many types of radiocontrolled vehicles. These include on-road cars, off-road

trucks, boats, airplanes, and even helicopters. The "robots"now popular in television shows such as Robot Wars, are arecent extension of this hobby (these vehicles do not meet theclassical definition of a robot; they are remotely controlled bya human). Radio-controlled submarine also exist.

Page 19: INTRODUCTIO1.docx

ADVANTAGES

PROBLEMS FACED :

Page 20: INTRODUCTIO1.docx

Although the concept & design of the projectseemed perfect, there were some problems faced while actualimplementation:1. Connecting HandsFree of cell phone to DTMFdecoder IC input:There were several types of HandsFree cordsavailable in the market, the right one had to be chosen fromthem. Several ways to break up the cords and connect them tothe input of IC 8870 were tried & some were newly developedby us (e.g. Connecting Audio Jack of PC's speakers to the cellphone with help of an extender).Solution:Finally HandsFree cord's 'Earplugs' wereremoved & resulting set of wires were connected in anappropriate manner to the Decoder IC's input.

2. Selection of Mobile Phone:At first, latest cell phone like Nokia 5700,N-series were tried. But they couldn't give any output. Severalcell phones were tested with their respective Hansfree cords.Solution:The older version phones like Nokia 1100,Nokia2300 were found to be more suitable for the purpose. FinallyNokia 3315 was used.

Page 21: INTRODUCTIO1.docx

PIC16F877A

PIC16F87XA memory organization tutorial

PIC microcontroller is very convenient choice to get started with a microcontroller projects.In this PIC16F87XA memory organization tutorial we will study:

3 types of memories - Program Memory, Data Memory, and Data EEPROM

Important registers - STATUS register, TRIS register, and PORT register

direct and indirect addressing

how to write to Data EEPROM

how to read from Data EEPROM

Memory of the PIC16F877 divided into 3 types of memories: Program Memory  - A memory that contains the program(which we had written), after we've burned it. As a reminder, Program Counter executes commands stored in the program memory, one after the other.

Data Memory  – This is RAM memory type, which contains a special registers like SFR (Special Faction Register) and GPR (General Purpose Register). The variables that we store in the Data Memory during the program are deleted after we turn of the micro.

These two memories have separated data buses, which makes the access to each one of them very easy. Data EEPROM (Electrically Erasable Programmable Read-Only Memory) - A memory that allows storing the variables as a result of burning the written program.

Each one of them has a different role. Program Memory and Data Memory two memories that are needed to build a program, and Data EEPROM is used to save data after the microcontroller is turn off.Program Memory and Data EEPROM they are non-volatile memories, which store the information even after the power is turn off. These memories called Flash Or

Page 22: INTRODUCTIO1.docx

EEPROM. In contrast, Data Memory does not save the information because it needs power in order to maintain the information stored in the chip.

PIC16F87XA Program MemoryThe PIC16F87XA devices have a 13-bit program counter capable of addressing an 8K word x 14 bit program memory space. This memory is used to store the program after we burn it to the microcontroller. The PIC16F876A/877A devices have 8K words x 14 bits of Flash program memory that can be electrically erased and reprogrammed. Each time we burn program into the micro, we erase an old program and write a new one.

PIC16F876A/877A program memory map and stack

Program Counter (PC) keeps track of the program execution by holding the address of the current instruction. It is automatically incremented to the next instruction during the current instruction execution.

The PIC16F87XA family has an 8-level deep x 13-bit wide hardware stack. The stack space is not part of either program or data space and the stack pointer is not readable or writable. In the PIC microcontrollers, this is a special block of RAM memory used only for this purpose.

The CALL instruction is used to jump to a subroutine, which must be terminated with the RETURN instruction. CALL has the address of the first instruction in the subroutine as its operand. When the CALL instruction is executed, the destination address is copied to the PC. The PC is PUSHed onto the stack when a CALL instruction is executed, or an interrupt causes a branch. The stack is POP’ed in the event of a RETURN, RETLW or a RETFIE instruction execution.

The stack operates as a circular buffer. This means that after the stack has been PUSHed eight times, the ninth push overwrites the value that was stored from the first push. The tenth push overwrites the second push (and so on).

Each time the main program execution starts at address 0000 - Reset Vector. The address 0004 is “reserved” for the “interrupt service routine” (ISR).

If we plan to use an interrupt, our program will begin after the Interrupt Vector; and if not we can start to write from the beginning of the Reset Vector.

Here is a code where we use interrupt:

ORG 0x000 ; processor reset vector goto main ; go to beginning of main program ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contentsmovf STATUS,w ; move status register into W registermovwf status_temp ; save off contents of STATUS register..RETFIE

Page 23: INTRODUCTIO1.docx

main

CLICK HERE for PIC microcontroller interrupt tutorial.

Some of the memory is divided into the pages that are designed for write/burn the program into them; the remaining memory (Stack, Interrupt Vector, and Reset Vector) is hardware registers.

Attention! Program Memory is divided into the pages, where the program is stored. Data Memory is dividedinto the banks. The banks are located inside the RAM, where the special registers and the data located.

PIC16F87XA Data Memory OrganizationThe data memory is partitioned into multiple banks which contain the General Purpose Registers and the Special Function Registers. Number of banks may vary depending on the microcontroller; for example, micro PIC16F84 has only two banks.

Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as static RAM. While program is being executed, it is working with the particular bank. The default bank is BANK0.

To access a register that is located in another bank, one should access it inside the program. There are special registers which can be accessed from any bank, such as STATUS register.

PIC16F876A/877A register file map

In order to start programming and build automated system, there is no need to study all the registers of the memory map, but only a few most important ones:

STATUS register  – changes/moves from/between the banks

PORT registers  – assigns logic values (“0”/”1”) to the ports

TRIS registers  - data direction register (input/output)

You can learn about other registers at a later stage or as needed.

STATUS registerIn most cases, this register is used to switch between the banks (Register Bank Select), but also has other capabilities.

PIC STATUS register

With the help of three left bits (IRP, RP1, and RP0) one can control the transition between the banks:

IRP - Register Bank Select bit, used for indirect addressing method.

RP1:RP0: - Register Bank Select bits, used for direct addressing method.

To distinguish between the two methods, at this point, the will use the definition of fundamental concepts. Later on, the two methods will be studied in detail. 

Page 24: INTRODUCTIO1.docx

When the IRP Equal to 0, the program will work with banks 0, 1.When the IRP Equal to 1, the program will work with banks 2, 3.

The following table demonstrates, which of the Banks the program is working with, based on the selection of the RP0 and RP1 bits:

RP1:RP0 BANK

00 0

01 1

10 2

11 3

An example of using STATUS register and Register Bank Select bit:

1. bsf STATUS, 5 ; Change to Bank 1

2. clrf TRISB ; Set PORTB as output

3. bcf STATUS, 5 ; Change to Bank 0

In the first line, we are in changing/setting the 5th bit, RP0, in the STATUS register to 1, and thus, base on the table we are switching/selecting Bank 1. After PortB was set as output in the second line, we switched back to Bank 0 by in changing/setting the 5th bit, RP0, in the STATUS register to 0, in the third line.

C: Carry/borrow bit (ADDWF, ADDLW,SUBLW,SUBWF instructions) 1 = A carry-out from the Most Significant bit of the result occurred0 = No carry-out from the Most Significant bit of the result occurred

An example of using STATUS register and Carry/borrow bit:

1. Movlw 200

2. Addwf 100, 0

In this example, we are assigning value of 200 to the W (working) register. Then, we are adding the value of 100 and the W register together. The result is stored in W register and should be 300 (200+100). However, the maximum value is 256, resulting in carry out. The C (bit 0) of the STATUS register becomes 1 (C = 1). Register W will contain the reminder: 44.

DC: Digit carry/borrow bit (ADDWF, ADDLW,SUBLW,SUBWF instructions) (for borrow, the polarity is reversed)1 = A carry-out from the 4th low order bit of the result occurred0 = No carry-out from the 4th low order bit of the result

Z: Zero bit 1 = The result of an arithmetic or logic operation is zero0 = The result of an arithmetic or logic operation is not zero

The bits 3 and 4 are used with WDT - Watchdog Timer.

Page 25: INTRODUCTIO1.docx

PD: Power-down bit 1 = After power-up or by the CLRWDT instruction0 = By execution of the SLEEP instruction

TO: Time-out bit 1 = After power-up, CLRWDT instruction or SLEEP instruction0 = A WDT time-out occurred

PORT registerThe role of the PORT register is to receive the information from an external source (e.g. sensor) or to send information to the external elements (e.g. LCD). The 28-pin devices have 3 I/O ports, while the 40/44-pin devices, like PIC16F877, have 5 I/O ports located in the BANK 0.

1. PORTA is a 6-bit wide, bidirectional port. The corresponding data direction register is TRISA.Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input. Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output.

2. PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISB.Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input. Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output.

3. PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input. Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output.

4. PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually configurable as an input or output.

5. PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7) which are individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers.

Pin diagram of PIC16F877A

We can control each port by using an assigned address of specific port, but there is much easier way to control the port. We are allowed to use the names of the ports without considering their addresses.

For example: # define SWITCH PORTA, 0

We define a variable named SWITCH, which received a value of bit number 0 of the PORTA. Usually we define the ports at the beginning of the program, and then we use only the given names.

TRIS registerThe TRIS register is data direction register which defines if the specific bit or whole port will be an input or an output. Each PORT has its own TRIS register. Here's a map of the locations:

BANK0 BANK1

Page 26: INTRODUCTIO1.docx

PORTA TRISA

PORTB TRISB

PORTC TRISC

PORTD TRISD

PORTE TRISE

The default mode of each TRIS is input. If you want to set a specific port as exit you must change the state of the TRIS to 0.

Keep in mind: to change a specific port to an output, one should first move to the BANK1, make the change, and then return to BANK0. The default state of the banks is BANK0.

The running program is working only with one bank at all time. If not set otherwise, then as stated, the default bank is BANK0. Part of the registers located inside BANK0, and some are not. When we need to access a register that is not located inside BANK0, we are required to switch between the banks.

For example, the access to PORT registers is done inside BANK0. However, to change port from an input to an output and vice versa, we need to access TRIS register that is located inside BANK1. From the moment we moved to the BANK1, the program will always work with BANK1; at this time, to access registers inside BANK0, we will have to return to the situation in which our program will work with BANK0.

CLICK HERE to access PIC16F877A data sheet for more in formation on PIC memory organization

Direct and Indirect addressingDirect Addressing: Using this method we are accessing the registers directly by detecting location inside Data Memory from Opcode and by selecting the bank using bits RP1 and RP0 of the STATUS register.

Indirect Addressing: To implement indirect addressing, a File Select Register (FSR) and indirect register (INDF) are used. In addition, when using this method we choose bank using bit IRP of the STATUS register. Indirect addressing treated like a stack pointer, allowing much more efficient work with a number of variables. INDF register is not an actual register (it is a virtual register that is not found in any bank).

Don’t be confused! There is SFR (Special Function Register) - special registers of RAM, and there is FSR (File Select Register).

The following figure shows the two addressing methods:

Pin diagram of PIC16F877A

To the left you can see the direct addressing method, where the bank selection is made by RP bits and the referencing is made directly from memory Opcode by using the variable name.

Page 27: INTRODUCTIO1.docx

To the right you can see the indirect addressing method, where the bank selection is made by IRP bit and accessing the variable by pointer FSR.

Let’s explore the differences between the 2 methods:

We want to assign number 5 to the variable TEMP located at address 0X030. In the first row of each example, we will define the variable TEMP at the address 0X030.

Example of direct addressing:

1. TEMP Equ 0x030

2. Movlw 5

3. Movwf TEMP

It's easy to understand, that direct addressing method means working directly with the variables. In the second line we put the number 5 into the working register W, and in the line 3, the content of the W passes to the TEMP variable .

Example of indirect addressing:

1. TEMP Equ 0x030

2. Movlw 0x030

3. Movwf FSR

4. Movlw 5

5. Movwf INDF

In the second line, we put a value into the W register. In the third line, the value passes to the FSR register, and from this moment FSR points to the address of the TEMP variable. In the fourth line, the number 5 passes to the W register, and in the fifth line, we move the contents of W register (which is 5) to the INDF. In fact INDF performs the following: it takes the number 5 and puts it in the address indicated by FSR register.

PIC16F87XA Data EEPROMThe data EEPROM and Flash program memory is readable and writable during normal operation (over the full VDD range). This memory is not directly mapped in the register file space. Instead, it is indirectly addressed through the Special Function Registers.

There are six SFRs used to read and write to this memory:

1. EECON1

2. EECON2

3. EEDATA

4. EEDATH

5. EEADR

6. EEADRH

When interfacing to the data memory block, EEDATA holds the 8-bit data for read/write and EEADR holds the address of the EEPROM location being accessed. These devices have 128 or 256 bytes of data EEPROM (depending on the device), with an address

Page 28: INTRODUCTIO1.docx

range from 00h to FFh. On devices with 128 bytes, addresses from 80h to FFh are unimplemented.

A few important points about Data EEPROM memory:

It lets you save data DURING programming

The data is saved during the “burning” process

You can read the data memory during the programming and use it

The use is made possible with the help of SFR

At this point there is no need to learn how to use this memory with special registers, because there are functions (writing and reading) that are ready.

Write to DATA EEPROMTo write to an EEPROM data location, the user must first write the address to the EEADR register and the data to the EEDATA register. Then the user must follow a specific write sequence to initiate the write for each byte.

BSF STATUS, RP1 ;BSF STATUS, RP0 ; Bank 3BTFSC EECON1, WR ;Wait for writeGOTO $-1 ;to completeBCF STATUS, RP0 ;Bank 2MOVF DATA_EE_ADDR, W ;Data MemoryMOVWF EEADR ;Address to writeMOVF DATA_EE_DATA, W ;Data Memory ValueMOVWF EEDATA ;to writeBSF STATUS, RP0 ;Bank 3BCF EECON1, EEPGD ;Point to DATA memoryBSF EECON1, WREN ;Enable writesBCF INTCON, GIE ;Disable INTs.MOVLW 55h ;MOVWF EECON2 ;Write 55hMOVLW AAh ;MOVWF EECON2 ;Write AAhBSF EECON1, WR ;Set WR bit to begin writeBSF INTCON, GIE ;Enable INTsBCF EECON1, WREN ;Disable writes

Read DATA EEPROMTo read a data memory location, the user must write the address to the EEADR register, clear the EEPGD control bit (EECON1<7>) and then set control bit RD (EECON1<0>). The data is available in the very next cycle in the EEDATA register; therefore, it can be read in the next instruction. EEDATA will hold this value until another read or until it is written to by the user (during a write operation).

BSF STATUS, RP1 ;BCF STATUS, RP0 ; Bank 2MOVF DATA_EE_ADDR, W ; Data MemoryMOVWF EEADR ; Address to readBSF STATUS, RP0 ; Bank 3

Page 29: INTRODUCTIO1.docx

BCF EECON1, EEPGD ; Point to Data memoryBSF EECON1, RD ; EE ReadBCF STATUS, RP0 ; Bank 2MOVF EEDATA, W ; W = EEDATA

Both of these functions are provided by the manufacturer. There is a required sequence in order to write/read to/from the memory; that process can be performed independently, but it is better to use ready functions of Microchip.

PCB LAYOUT

Page 30: INTRODUCTIO1.docx

PCB DESIGN PROCEDURE

Page 31: INTRODUCTIO1.docx

Keychain camera

Page 32: INTRODUCTIO1.docx

Its ultra small, light weight design and low cost make it a great camera for casual in flight videos.

Strap it to your wing, fuse, tail, canopy or just about anywhere. Its recessed buttons prevent vibration from changing the functions and makes it easier to attach to your model. And because the camera lense is mounted on the edge the whole case is more aerodynamic than other cameras.The SD card (Not included) is removable and the camera has a USB port for direct PC copying.There are many similar cameras to this one on the market, but be assured this model has a true 30 frames per second rating and works perfect with a fast SANDisk memory card (Sold Separately) for jitter free picture motion. Lense hardware is 640x480px and maintains the correct aspect ratio without AVI manipulation*. Producing a clear 640x480 AVI jitter free   movie.

Specification: Size: 52x30x12mmWeight: 18g incl. battery & keychain

Video lense: 640x480 pixel (correct aspect ratio)Battery: Lithium Polymer FPS: 30 (True Rating)

Pixel: 1280x960

Continuous video recording time: 60min

Voice-activated standby time: 120 hours standby timeCapacity of memory card: Can support upto 16GB (max.)

USB interface: USB1.1/2.0

 

Included accessories:Turnigy TD16 camera

USB Connector

*Other similar cameras have software AVI formatting to 720x480px, reducing clarity of the 640x480 native image from the lense. While this sounds good on paper, it makes the movie less clear and enjoyable.

Required:Micro SD card 2GB

Page 33: INTRODUCTIO1.docx

FURTHER IMPROVEMENTS & FUTURE SCOPE :1. IR Sensors:IR sensors can be used to automatically detect &avoid obstacles if the robot goes beyond line of sight. Thisavoids damage to the vehicle if we are maneuvering it from adistant place.

3.Password Protection:

Project can be modified in order to passwordprotect the robot so that it can be operated only if correctpassword is entered. Either cell phone should be passwordprotected or necessary modification should be made in the

assembly language code. This introduces conditioned access &

increases security to a great extent.

3. Alarm Phone Dialer:By replacing DTMF Decoder IC CM8870 by a'DTMF Transceiver IC’ CM8880, DTMF tones can be generatedfrom the robot. So, a project called 'Alarm Phone Dialer' can bebuilt which will generate necessary alarms for something that

Page 34: INTRODUCTIO1.docx

is desired to be monitored (usually by triggering a relay). Forexample, a high water alarm, low temperature alarm, openingof back window, garage door, etc.When the system is activated it will call anumber of programmed numbers to let the user know thealarm has been activated. This would be great to get alerts ofalarm conditions from home when user is at work.

4. Adding a Camera:If the current project is interfaced with a camera(e.g. a Webcam) robot can be driven beyond line-of-sight &range becomes practically unlimited as GSM networks have avery large range.

Page 35: INTRODUCTIO1.docx

REFERENCES:1. Wikipedia - The free encyclopedia2. http://www.8051projects.info/3. http://www.instructables.com/4. Schenker, L (1960), "Pushbutton Calling with a Two-GroupVoice-Frequency Code", The Bell system technical journal 39(1): 235–255, ISSN 0005-8580

5. “DTMF Tester” , ‘Electronics For You’ Magazine , Edition(June 2003)6. http://www.alldatasheet.com/7. http://www.datasheet4u.com/8. http://www.datasheetcatalog.com/