PROJECT REPORT (Jan 3rd - Jan 8)
PROJECT REPORT (Jan 3rd - Jan 8)
Our project is Mobile/Laptop controlled Electric Car. Project aims in driverless ride. We are using PIC16F877 microcontroller for our project. We studied the architecture of PIC. We studied about the classifications of PIC. We got an idea about the pins of PIC microcontroller. We are using PIC microcontroller because of its RISC (Reduced Instruction Set Computing). There are only 35 instructions. Different memories of PIC were studied. Also Program memory organization of PIC was studied. Different architectural features were also studied. The familiarization of Assembly Language program was our main aim throughout the week during which we were able to cover the instruction sets, simple logics etc. A brief overview about our work during this week is given below : Details of the Architecture 14 bit instructions 8 bit data values, byte addressed Harvard architecture (separate address/data memory)
Storage capacity: 8k x 14 Flash EPROM (program storage) 256x8 EEPROM 368x8 SRAM (data storage) Universal Asynch./Synch. Receiver/Transmitter(UART) 8 channel, 1-bit A/D converter. RISC architecture
Consumption: 220uA (2.0V, 4MHz), 11uA (2.0 V, 32 KHz) 50nA (stand-by mode)
Power-Saving Sleep Mode Brown-out Reset (BOR) with software control option
16F877 Instruction Set : 3 types of instructions: Byte-oriented operations Bit-oriented operations Literal and control operations Format of Instructions
Bit-oriented Instructions
Instructions BCF and BSF clear or set any bit in memory. Although it seems to be a simple operation, it is not like that. CPU first reads the entire byte, changes one its bit and rewrites the whole byte to the same location.
Byte-oriented Instructions
These include Arithmetic and data transfer instructions. Data Transfer within the microcontroller takes place between working register W (called accumulator) and a register which represents any location of internal RAM regardless of whether it is about special function or general purpose registers. PIC supports only two arithmetic instructions- addition and subtraction. Flags C, DC, Z are automatically set depending on the results of addition or subtraction. The only exception is the flag C
to RETURN instruction, with exception that a constant defined by instruction operand is written to the W register prior to return from subroutine. This instruction enables Lookup tables to be easily created by creating a table as a subroutine consisting of RETLWk instructions, where the literals k belong to the table. The next step is to write the position of the literals k (0, 1, 2, 3...n) to W register and call the subroutine (table) using the CALL instruction. Table below consists of the following literals: k0, k1, k2...kn.
PROGRAM
; Mobile Controlled Electric Car Program LIST P=PIC16F877 #INCLUDE"P16F877.INC" CBLOCK 0X20 BIN1 TEL1 TEL2 TEL3 ENDC ORG 0X00 BSF STATUS,RP0 MOVLW 0X00 MOVWF TRISB MOVLW 0XFF MOVWF TRISC BCF STATUS,RP0 CALL BEEP MP GOTO MP BTFSC PORTC,4 GOTO $-1 CALL BEEP MOVLW 0X0F ANDWF PORTC,0 MOVWF BIN1 GOTO MNO MNO MOVLW 0X0C ;# KEY SUBWF BIN1,0 BTFSS STATUS,Z GOTO MP GOTO MP1 BTFSS PORTC,4 ;steering
; BINARY VALUE
MP1 BTFSS PORTC,4 ;steering GOTO MP1 BTFSC PORTC,4 GOTO $-1 MOVLW 0X0F
ANDWF PORTC,0 ;BINARY VALUE MOVWF BIN1 ;;;;;;;;;;;;;;;;;;;;;; MOVLW 0X01 ;1 KEY SUBWF BIN1,0 BTFSC STATUS,Z GOTO FF ;GOTO MP1 MOVLW 0X02 ;2 KEY SUBWF BIN1,0 BTFSC STATUS,Z GOTO FR ;GOTO MP1 MOVLW 0X03 ;3 KEY SUBWF BIN1,0 BTFSC STATUS,Z GOTO FL ;GOTO MP1 MOVLW 0X04 ;4 KEY SUBWF BIN1,0 BTFSC STATUS,Z GOTO RR GOTO OK4
FF
CALL BEEP BSF PORTB,7 CALL TELAY1 BSF PORTB,3 CALL TELAY1 BCF PORTC,6 CALL TELAY1 BCF PORTD,6 CALL TELAY1
;SINGLE ;SINGLE
;DUAL ;DUAL
GOTO MP1 FR CALL BEEP BSF PORTB,7 CALL TELAY1 BCF PORTB,3 CALL TELAY1 BCF PORTC,6 ;DUAL
CALL TELAY1 BCF PORTD,6 CALL TELAY1 GOTO MP1 FL CALL BEEP BCF PORTB,7 CALL TELAY1 BSF PORTB,3 CALL TELAY1 BCF PORTC,6 CALL TELAY1 BCF PORTD,6 CALL TELAY1 GOTO MP1 RR CALL BEEP BCF PORTB,7 CALL TELAY1 BCF PORTB,3 CALL TELAY1 BSF PORTC,6 CALL TELAY1 BSF PORTD,6 CALL TELAY1 GOTO MP1 OK4 CALL BEEP CLRF PORTB CALL TELAY1 GOTO MP1 BSF PORTB,0 CALL TELAY1 BCF PORTB,0 CALL TELAY1 RETURN
;DUAL
;DUAL ;DUAL
;DUAL ;DUAL
BEEP
TELAY1 MOVLW D'5 ; 1 Sec delay MOVWF TEL3 MU3 MOVLW D'255' MOVWF TEL1 MU2 MOVLW D'70' MOVWF TEL2 MU1 DECFSZ TEL2,1 GOTO MU1 DECFSZ TEL1,1 GOTO MU2 GOTO MUP MUP DECFSZ TEL3,1 GOTO MU3 RETURN
END
PROJECT MEMBERS
1. 2. 3. 4. 5. Rahul S Shajil.P.D Nithin.R Raghav.M.Nair Nidhin.P