Académique Documents
Professionnel Documents
Culture Documents
1
C programming
*/ to end 8
C Programming
What is the scope of a bit variable (hint you may wish to try this in your code) bit variables must be global or static 13
Practical
Explain the steps required to determine the time of execution of the following code running on a 4MHz device
for(int i = 0 ; i ,= 33000 ; i++) {}
Include the setting of breakpoints, setting the sim frequency, running to first break, zero stopwatch, run to second break, note time 14
Programming
Write the declaration for an array of a char variable data which contains the following data: 0xff, 0b10101010, 234, 112, 0x34 char data[] = {0xff, 0b10101010, 234, 112, 0x34} ;
15
Programming
Write the statement to place the number 112 into address 254 of the EEPROM eeprom_write(254, 112) ; 16
Programming
Write a statement to display the number 7 on the right. displayDigit (7, RIGHT) ; 17
Hardware
State the number of bytes available as general purpose registers 368 - See page 25 of the manual 19
Hardware
State the Total number of bytes of RAM memory 512 - See page 25 of the manual 20
Hardware
State the number of RAM bytes used by SFR's (Special Function Registers) 143 - See page 25 of the manual 21
Instruction set
With reference to the resource PIC Instruction Set page 29-3, State the number of bits used for the opcode for a Byte-oriented file register operations
6 - Bits 8 to 13 inclusive 22
Fetch - Execute
What is the purpose of the 'Fetch - Execute' cycle check google for answer - see lecture week 4 23
Fetch - Execute
What causes the program counter to point to the first instruction of a program ? Power on, Reset and Watch Dog timer overflow 25
Stack
How many levels of stack are available ? 8 27 Stack Does the Interrupt function use the stack a) True b) False It doesYour answer has been saved. 28
Interrupts
Which SFR's need to be set / reset to use the external interrupt - list them and their condition. // enable external interrupts, reset external interrupt flag, enable global interrupts ANSELH = 0 ; // extra code for this device to enable port B digital inputs - specifically the interrupt
TRISB0 = 1 ; // the external interrupt button is on Port B bit zero RBPU = 0 ; // enable PORTB pull ups INTEDG = 0 ; INTE = 1 ; INTF = 0 ; GIE = 1 ; 29
Global volatile
Write the declaration for a global volatile variable letter volatile char letter ; 30
RISC devices
State three features commonly found in RISC microprocessors Harvard architecture Single cycle Instructions Reduced Instruction set.