Sie sind auf Seite 1von 4

Question 1 relates to C Programming and the HI Tech Universal compiler Question 1.

1 state the action of the compiler when is reads the line # define MAX_STEPS 300 A) Find and replace the value of Max_steps to 300
7 marks

Question 1.2 Write the code for an interrupt function called ISR The ISR will: check for the timer zero interrupt flag and if true reset the flag set timer zero register to 12 exit the function

{T0IF=1; // reset the flag TOR0=12;// set timer zero to 12 }


6 marks

Question 1.3 Write a segment of code that will add 1 to the value of PORTC if x isgreater than or equal to127

if (x>=127) {PORTC =PORTC+1; ;


6 marks

Question 1.4 Using the two variable declarations below, write the code required to convert ASCIIcharacter to numberValue char ASCIIcharacter = "7" ; char numberValue ;

Number value = ASCII-0X30; Number value = 7-0x30;


5 marks

Question 1.5 State the value of PORTC after execution of the following block of code: PORTC = 0b10101010 ; PORTC = PORTC & 0b11110000 ;
A) 0b10101010 B) 0b10100000 C) 0b00001010 D) 0b11111010 Page 1

4 marks

Question 3.2 Timer zero


Question 3.2.1

A target board has an oscillator frequescy of 4MHz. The Option Register shown in the graphic window is set to 0b00000111 The Timer Zero Interupt flag will be set every:
A) 56.536 mSec B) 13.1 mSec C) 33.7 mSec D) 262 mSec 65.536 ms

4 marks Question 3.2.2

A target board has a 4MHz osc. The timer zero prescaler has the Prescaler Rate Select bits set to 010. What is the timer zero divide rate 1:8
4 marks

Question 3.3 Serail communications


Question 3.3.1

State the register which controls the serial transmission / reception baud rate Special function register
4 marks Question 3.3.2

Write a line of code to transmit the byte value in PORTD


TXREG=PORTD

4 marks

Question 3.4 State the port pin to which the external interrupt is connected on a PIC16F887.
4 marks RB0 PIN

Question 3.5 Analogue to Digital conversion


Question 3.5.1

State the type of Analogue conversion used on the PIC16F887 and state the number of bits of resolution.
6 marks Successive approximation 10bits Question 3.5.2

On a PIC16F887 an analogue to digital conversion produces the following result 0b1101010111 (10 bits). The ADCON1 register is set to 0b01000000 State the value in the ADRESH register State the value in the ADRESL register
4 marks

Question 3.5.3

State the number of analogue nputs available on the PIC16F887 8 input bits
4 marks

Question 4 relates to interfacing Hardware to the PIC. Question 4.1 LCD Display.
Question 4.1.1

The LCD Displays used for your lab communicate in which 'data mode' ?
Page 4 A) command B) serial C) nibble D) byte 3 marks

Question 4.1.2

Write the sequence of code to set the display the integer variable number from the 4th character position on line 2 (Note the LCD.h file is available on your test H drive.)

6 marks

Question 5 relates to Structured Programming Question 5.1 The shape of a flowchart item for decisions is:
A) Oval B) Diamond C) Rectangle

3 marks

Question 5.2 The shape of a flowchart item for statements is:


A) Oval B) Diamond C) Rectangle

3 marks

Question 5.3 A Decision symbol has a single input and a maximum of ? outputs
A) 1 B) 2 C) 3 D) unlimited 3 marks Total marks for assessment: 100 Page 5

q- write the proto type declaration line an interrupt function called ISR

a1- void interrupt ISR (void); q to change the pwm ratio you need to change the value of the which registersbits? A2- CCPR1L AND CCP1CON<5:4>

Q- write the code to place the current value of timer 1 into the variable defined below Int timerOne Value; A3- timerOneValue=TMR1H<<8; TimerOneValue= timerOneValue+TMR1L Q-state the purpose of the PEIE bit(bit6)of the INTCON register A4- to enable peripheral interrupts

Das könnte Ihnen auch gefallen