CCP-merged - Lecture notes 1,3,7 PDF

Title CCP-merged - Lecture notes 1,3,7
Author piyush barhanpurkar
Course Programming with C++
Institution Massachusetts Institute of Technology
Pages 36
File Size 1006.3 KB
File Type PDF
Total Downloads 49
Total Views 163

Summary

Mr Kurtin sewty...


Description

1. In the ……………. method, each character is placed between start and stop bits. a) Synchronous b) Asynchronous c) Both of these d) None of these ANS : b)

2. For high speed, set the ………….. bit in TXSTA register. a) TXSTA b) BRGH c) Both of these d) None of these ANS : b)

3. ……………………. is used for selecting the operating mode of the CCP module. a) CCP b) CCP1CON c) CPIRF d) CPIF

ANS :b=)

4. By clearing the SYNC bit in TXSTA register we select ………….. mode.

a) Synchronous b) Asynchronous

c) Both of these d) None of these ANS : b)

5. When RS = 0, ……………………….. get selected for user to send command such as clear display, curser at home. a) Command code register b) data code register c) Both of these d) None of these ANS : a)

6. When…………….. for reading information from LCD. a) R/W = 1 b) R/W = 0 c) Both of these d) None of these ANS : a)

7. In busy flag concept, When …………… the LCD is busy taking care of internal operation and will not accept any new information.

a) D7=0 b) D7=1 c) Both of these d) None of these ANS : b)

8. CCP stands for………………….

a) Capture, Compare, PWM b) Capture, Capture, PWM c) Controller CAN PWM d) None of these ANS : a)

9. In the instruction, if lcdcmd (0*… = ????) ;

// line 1 position 6

a) 80 b) 84 c) 85 d) 86 ANS : d)

10. Generally, it is recommended to check the …………….flag before writing data/command to the LCD.

a) Carry b) Overflow c) Busy d) None of these ANS : c)

****************************END********************************

Total number of CCP modules in PIC18F458 microcontroller are The timer which can be used in Compare mode of PIC18f458 microcontroller is Which Register is used for selection of Timer in Compare and Capture mode? In which modes/mode the are DC1B1 and DC1B2 bits in CCP1CON register are used ? Which is a SFR which contains CCP1IF flag? register How does the pin RC2/CCP1 get configured while initializing the CCP module in the compare mode of operation? For a PIC18f458 microcontroller, in Compare mode, the comparision of contents of which registers take place?

In the PWM mode, what does the value loaded in PR2 register determines ? In a pulse waveform the ON period is 300 microseconds and OFF period is 100 microseconds. Calculate the duty cycle of the waveform Which of the following timers is a 8 bit timer What is the bitlength of CCPR1 register? If the Oscillator frequency is 10MHz and a prescalar of 2 is used for timer 3, What is the frequency at which Timer 3 works Which is the correct instruction written in C language which will start Timer 3 What is the value of Prescalar which should be used so that the timer has maximum timer period.

1 2 3 4 Timer 2 or Timer Timer 1 or Timer Timer 0 or Timer Timer 1 or Timer 3 0 1 3

1

4

4

4

T3CON Compare mode and Capture mode

T2CON

T1CON

1

4

Capture Mode and PWM

Only Capture Only PWM mode mode

3

4

T3CON

PIR1

2

4

2

4

1

4

3

4

2 3 4

4 4 4

4

4

1

4

4

4

1

4

1

4

3

4

3

4

3

4

3

4

T0CON

T1CON without the As an input by As an output by necessity of writing it in TRISC writing it in TRISC writing or register register specifying it in CCPR1L and TMR1 and CCPR1 TMR1 and TMR3 CCPR1H

the Time period The ON period of the OFF period of of PWM PWM waveform PWM waveform waveform

100% Timer 0

Timer 1 2

75% Timer 2 4

CCP1CON does not support pin RC2/CCP1 configuration CCP initialization

TMR0and CCPR1 the ON and OFF period of PWM Wave form remains unaffected

33% Timer 3 8

25% 16

10MHz 2MHz 2.5MHz 1.25MHz T3CONbits.TMR3 T3CONBITS.TMR T3CONbits.tmr3o t3conbits.tmr3on ON=1; 3ON=1; n=1; =1;

4 8 16 Comare mode is Capture mode is PWM mode is activated activated activated When contents When contents When contents When contents of TMR2 is equal of TMR2 is equal of TMR2 is not of TMR2 is equal to CCPR1H to CCPR1L equal to PR2 register register register In a PWM mode , when does the TMR2IF flag Set to PR2 register CCP1 pin makes a CCP1 pin makes a transtion from transtion from CCP1 pin remains Toggles the CCP1 What will happen If CCP1CON is loaded by 0X0A, High to low unaffected pin Low to High For generation of PWM waveform of frequency 2.5 KHz with a duty cycle of 75% what is a decimal value that needs to be loaded in PR2 register. Assume a prescalar of 4 is used and 240 255 249 149 oscillator frequency is 10MHZ Find CCP1CON register value if Compare mode needs to be selected and toggle the output pin on Match 0x01 0x05 0x02 0x06 For generation of PWM waveform of frequency 2.5 KHz with a duty cycle of 75% what is a decimal value that needs to be loaded in CCPR1Lregister. Assume a prescalar of 4 is used and oscillator frequency is 10MHZ 249 189 186 196 CCP1 module is What will happen If CCP1CON is loaded by 0X30, disabled

2

1. Serial communication indicates……………………. a) Only one bit is transferred at a time over one line.

b) Only Two bit is transferred at a time over one line. c) Only Three bit is transferred at a time over one line. d) Only Four bit is transferred at a time over one line. ANS : a)

2. To allow Serial communication with the PIC 18, we need to set different parameters within 2 registers, a) TXSTA b) RCSTA c) Both of these d) None of these ANS ; c)

3. CAN stands for………………………. a) Controller Access Net b) Communication Access Net c) Controller Area Network d) None of these

ANS : c)

4. In………………………. method transfer a block of data at a time.

a) synchronous b) asynchronous c) Both of these d) None of these ANS : a)

5. In synchronous Communication both the receiver & transmitter have the……………clock. a) Two b) Four c) same d) different ANS : c)

6. ………… is communication protocol that is used for exchanging data between two devices. a) RS-230 b) RS-231 c) RS-233 d) RS-232 ANS : d)

7…………….. is a line driver (voltage converter) that converts RS-232 voltage level to TTL voltage levels & vice versa.

a) MAX 231 b) MAX 232 c) MAX 233 d) All of these

ANS : b)

8. PIC 18 transfer & receives the data serially at different baud rates, for this purpose ……………. is used.

a) SPI b) I2C c) USART d) SPBRG ANS : d)

9 If Fosc = 10MHz then,n kduk.;’gsm’peg’kowbekF Instruction cycle frequency = ……………….. a) 2 MHZ b) 2.5 MHZ c) 10 MHZ d) None of these ANS : b)

10. Byte of data to be transferred via Tx pin, it must be placed in ……………. register.

a) TXREG b) RCSTA c) Both of these d) None of these ANS : a)

****************************END********************************

p 1 If we want 9 bit transmission, then ………. bit in the TXSTA register should be set indicating select 9 bit transmission. a) TX0. b) TX7. c) TX8 . d) TX9 . ANS : d)

2. The ……………… flag indicates the status of TSR whether it is empty or full. a) TXIF b) TRMT c) Both of these d) None of these ANS ; b)

3. TXIF can be enabled/disabled by ……………………bit. a) TSR b) RSR c) TXIE d) None of these

ANS : c)

4. If the …………. bit in the TXSTA register is cleared, then ongoing transmission will be aborted.

a) SPEN b) TXEN c) Both of these d) None of these ANS : b)

5. The TSR register transmits 10 bit data …………………..through the TX pin. a) (8 bit data from TXREG + 2 start bit) b) ( 8 bit data from TXREG + 2 stop bit) c) ( 8 bit data from TXREG + 1 start bit + 1 stop bit) d) None of these ANS : c)

6. After the data is transmitted, the TSR register is……… & TXREG is ……………….. a) full, empty b) full, full c) empty, empty d) None of these ANS : a)

7. After checking the stop bit, the USART moves data bits into buffer & then into ………..

a) TXREG b) RCREG c) Both of these d) None of these ANS : b)

8. Whenever the …………… is empty, it gets its data from TXREG, & clears the TXREG register immediately, so it does not send out same data twice.

a) TSR b) RSR c) USART d) SPBRG ANS : a)

9 For a moment byte is written into TXREG, it is fetched into a register called …………….. a) TSR b) RSR c) USART d) SPBRG ANS : a)

10. We monitor the TXIF flag bit to make sure that all the bits of the last byte are transmitted before we write another byte into the …………………...

a) TXREG b) RCSTA c) Both of these d) None of these ANS : a)

****************************END********************************

1. TMR0IF stands for……………… a) Timer 0 Interrupt Flag b) Timer 1 Interrupt Flag c) Timer 0 Interface Flag d) None of these

Ans. ( a )

2. In PIC 18 Timers, Timer1 & Timer3 are ......bit and Timer2 & Timer4 ……bit a) 8,8 b) 16,8 c) 8,16 d) 16,16

Ans. ( b)

3. T0CON register is of ……… bit. a) 4 b) 8 c) 16 d) 32

Ans. ( b)

4. What is the value of T0CON register for following configuration. •

8 BIT DATA



INSTRUCTION CYCLE



RISING EDGE



PRESCALER 1:8

a) 32H b) 44H c) 24H d) 42H Ans. ( d )

5. In T0CON register prescaler is not assigned then PSA = ……… a) 1 b) 0 c) Both of these d) None of these Ans. ( a )

6. When timer is used as 16-bit, once it reaches its maximum value ………., it rolls over to minimum value ……… & TMR0IF flag bit is …………. a) FFH,00H, SET b) FFFFH,0000H, SET c) FFH,00H, RESET d) FFFFH,0000H, RESET Ans. ( b )

7. To start the Timer0, ……….. bit should be ON.

a) TMR1ON b) TMR2ON

c) TMR3ON d) TMR0ON Ans. ( d )

8. In Timer 1 Control Register ………… bit is used for synchronization. a) T1SYNC b) T2SYNC c) T3SYNC d) T0SYNC Ans. ( a )

9. When Timer 0, 16 bit mode, no prescaler is used then T0CON = ………..

a) 80H b) 32H c) 08H d) 00H Ans. ( c )

10. When Timer 0, 16 bit mode, 1:4 prescaler is used then Timer clock frequency is……

a) 60Hz b) 0.666MHz c) 0.600MHz d) 0.625MHz Ans. ( d )

***********BEST LUCK***********

1. T1CON register is of ………bit. a) 8 b) 16 c) 24 d) 32 ANS : a)

2. To start the Timer in Timer 1 …….. bit should be set. a) TMR0ON b) TMR1ON c) Both of these d) None of these ANS ; b)

3.In Timer 1 Control Register, if RD = 1 then,…………………. a) Enables Timer 1 in 16 bit operation. b) Enables Timer 1 in two 8 bit operation. c) Both of these d) None of these

ANS : a)

4. Maximum value of prescaler in Timer 1 is …………….. a) 1:1

b) 1:2 c) 1:4 d) 1:8 ANS : d)

5. SFR of Timer 3 is………………. Register. a) T0CON b) T1CON c) T2CON d) T3CON ANS : d)

6. Postscale and prescale select bits are present only ……. a) T0CON b) T1CON c) T2CON d) T3CON ANS : c)

7. TOUTPS3 stands for…………….. a) Timer 0 output post scale select Bits b) Timer 1 output post scale select Bits c) Timer 2 output post scale select Bits d) Timer 3 output post scale select Bits ANS : c)

8. After executing BSF T0CON,TMR0ON instruction……………….. a) Start Timer 0 b) Start Timer 1

c) A Start Timer 2 d) Start Timer 3 ANS : a)

9. After executing BCF TRISC,2 instruction………………..

a) RC2 b) RC2 = OUTPUT PIN c) Both of these d) None of these ANS : b)

10. After executing PIR1bits.TMR1IF= 0 instruction……………….. a) Clear Timer 0 IF b) Clear Timer 1IF c) Clear Timer 2 IF d) Clear Timer 3 IF ANS : b)

****************************END********************************

AMA_PIC MCQs - Unit-II Sr. No. Question

option 1

option 2

option 3

option 4

Correct option

1

The methods by which address locations are specified are called as……

Timers

Counters

Opcodes

addressing modes 4

2

In ………………….. Addressing mode, the sourse operand is a constant rather than a veriable.

Immediate

Direct

Register Indirect

Indexed ROM

1

3

FSR is a …………………. Bit register.

8

12

16

24

2

4

In ………………….. Addressing mode, the 8 bit data is in a RAM memory location whose address is specified in the instruction.

Immediate

Direct

Register Indirect

Indexed ROM

2

5

FSR stands for …………………..

Flag Select Register

File Select ROM

File Set Register

File Select Register 4

6

In ………………….. Addressing mode, a register is used as a pointer to the ROM location of the Immediate file register.

Direct

Register Indirect

Indexed ROM

3

7

In PIC18F, fs ( sourse file) and fd ( Destination file) are of ………… bit.

4

8

12

16

3

8

GIE stands for……………………..

German Interrupt Enable bit

Global Global Interface Interrupt Enable bit Enable bit

None of these

3

9

InPIC18F, for multiplication ……………… instruction is used.

MULLW

PRODLW

Both of these

None of these

1

10

………………….. Addressing mode is used for accessing the data from look-up tables that reside in the PIC18 program ROM.

Immediate

Direct

Register Indirect

Indexed ROM

4

11

In PC18F, Access bit a=0, then………………

RAM location in access RAM is specified Both of these RAM by BSR Register

None of these

1

12

In PC18F, Access bit a=1, then………………

RAM location in access RAM is specified Both of these RAM by BSR Register

None of these

2

13

In PIC18F, PCLATU indicates…………………

Program Counter Upper Bit Latch

Both of these

None of these

2

14

In PIC18F, PCLATH indicates…………………

Program Counter High Bit Latch

Both of these

None of these

2

15

In PIC18F, PCH indicates…………………

Program Counter High Bit

Both of these

None of these

2

16

In PIC18F, PCL indicates…………………

Program Counter Low Bit

Program Counter Low Byte

Both of these

None of these

2

17

In PIC18F Instructions CLRDWT = …………………..

Clear Watchdog Timer

Carry Watchdog Clear Working Clear Watchdog Timer Timer Test

18

In PIC18F Instructions NOP = ………………….. No Problem

NO Operation

Both of these

None of these

19

In PIC18F Instructions DAW = ………………….. Data Adjust WREG

Decimal Accumulator Work

Decimal Accumulator WREG

Decimal Adjust WREG

4

20

In PIC18F Instructions BRA instruction indicates …………………..

Branch Both of these unconditionally

None of these

2

21

………………….. Covers the cpmplete 4KB RAM SFR space of the PIC18.

FSR

BSR

all of these

2

22

In PIC18F, TBLPTR stands for…………….

12-bit Table Pointer

16-bit Table Pointer

21-bit Table Pointer

4

Branch conditionally

8-bit Table Pointer

Program Counter Upper Byte Latch Program Counter High Byte Latch Program Counter High Byte

1

2

23

Each FSR register is associated with an indirect register…………..

F

W

BSR

INDFx

4

Sr. No. 1 2 3

Question …………………...mode is commonly used in modulation of DC power for a lamp circuit to control the brightness or speed of DC motor. Register CCPR1H:CCPR1L is of ……………………...bit …………….. mode is commonly used to generate pulses or periodic waveform.

option 1

option 2

option 3

option 4

Correct option

1. CCP

2. Capture

3. compare

4. PWM

4

1. 8

2. 16

3. 32

4. 64

2

1. CCP

2. Capture

3. compare

4. PWM

3

1. Prescaler

2. Postscaler

both of these

None of these

1

4

I฀ n the CCP Module, ………... can be used to get a very fine average resolution on a constant input frequency.

5

The control bits …………………….. in the CCP1CON register are used for selecting the event.

1. CCP1M3

2. CCP1M0

3. CCP1M3: CCP1M0

4. None of these

3

6

CCP stands for …..

Counter Compare PWM

Capture Compare PWM

both of these

None of these

2

7

PWM indicates……………………

Program word Mode

Pulse Word Mode

Pulse Working mode

Pulse Width Modulation

4

8

……………………. feature allows the programmer to generate pulses that are having variable widths.

1. CCP

2. Capture

3. compare

4. PWM

4

9

PIC18F family supports ……….. Compare/Capture/PWM (CCP) modules depending on the PIC family member.

0

1

2

0 to 5

4

10

ECCP indicates……………………..

Energy CCP

Editor CCP

Enhanced CCP

None of these

4

11

Find CCP1CON register value if Compare mode needs to be selected and toggle the output pin on Match

0x01

0x05

0x02

0x06

3

12

For generation of PWM waveform of frequency 2.5 KHz with a duty cycle of 75% what is a decimal value that needs to be loaded in CCPR1Lregister. Assume a prescalar of 4 is used and oscillator frequency is 10MHZ

249

189

186

196

3

4

1

13 14

Total number of CCP modules in PIC18F458 microcontroller are The timer which can be used in Compare mode of PIC18f458 microcontroller is

1

2

Timer 2 or Timer 3

Timer 1 or Timer 0

CCP1 module is Comare mode is disabled activated Wh...


Similar Free PDFs