Compare commits

...

5 Commits

Author SHA1 Message Date
0ceb20bcf1
add computer engineering slides 2023-12-28 20:18:17 +00:00
f266085c4e
add mechatronics lecture slides 2023-12-28 20:16:19 +00:00
5b64235c97
add past papers 2023-12-28 20:13:00 +00:00
b3d42c30d9
add lecture slides, lectur notes 2023-12-28 20:12:23 +00:00
a84913e3f5
add exercise sheets 2023-12-28 19:49:08 +00:00
57 changed files with 58696 additions and 0 deletions

View File

@ -0,0 +1,15 @@
Fred Bloggs 73
Michael Smith 43
Claire White 64
Simon Black 23
Joshua Mason -20
Jenny Jones 57
George Clark 40
Ann Bell 101
Fay Allen 52
John Morris 60
Steven Hayes 47
Hannah Jackson 94
Alex Benson 50
Susan Baker 70
Wendy Brooks 57

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

View File

@ -0,0 +1,27 @@
12
0
12.343
1
13.574
2
14.359
3
14.367
4
15.694
5
17.489
6
19.486
7
20.427
8
21.759
9
20.402
10
19.444
11
18.736
12
17.445

View File

@ -0,0 +1 @@
The quick brown fox jumped over the lazy dog!

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

View File

@ -0,0 +1,19 @@
#include <avr/io.h>
void setup()
{
DDRB |= (1<<7); // Set pin 13 as output
TCCR1A = (1<<WGM11) | (1<<COM1C1);
TCCR1B = (1<<WGM12) | (1<<WGM13) | (1<<CS10);
TCCR1C = 0; // No force output compare
ICR1 = 799; // Set PWM frequency noting prescale if any
OCR1C = 79; // Set PWM duty cycle as a fraction of ICR1
}
void loop()
{
}

View File

@ -0,0 +1,53 @@
// Program to generate and count pulses using hardware only.
// Also uses interrupt to handle register overflow.
// For Arduino Mega only, as T/C 1 Compare Output Channel C is linked to pin 13.
// Frequency generation loosely based on code within "Newbie's Guide to AVR Timers".
// The code is revised by Abdelkhalick Mohammad for MMME3085 Module.
#include <avr/io.h>
unsigned long bigLaps; // To record how many times T/C5 overflows
void setup()
{
Serial.begin(9600);
// ===Timer/Counter 5 settings to count input pulses ====
//set pin T5 as input (external); this is pin 47 (Arduino Mega pin mapping)
pinMode(47, INPUT);// set pin to input
TCCR5A=0;// No waveform generation needed (T/C is counting only)
TCCR5B=(1<<CS50)|(1<<CS51)|(1<<CS52);// Normal mode, external clock on rising edge
TCCR5C=0;//No force output compare (we will not study about this in the module)
TCNT5=0;//Initialise counter register to zero
TIMSK5=(1<<TOIE5);//When the T/C reach its maximum, an interrupt will be activated
bigLaps=0;//When an overflow happens, we will increase this bigLaps by 1
sei();// Enable all active interrupts
// === Timer/Counter 1 settings to generate pulses with different frequencies ===
DDRB|=(1 << 7);//T/C1 channel C is connected to pin 13, set it as output
TCCR1B=(1 << WGM12 );//Configure T/C1 for CTC mode
TCCR1A=(1 << COM1C0 );//Enable T/C1 Compare Output channel C in toggle mode
// OCR1A= 7;//Set CTC compare value to 2 MHz at 16MHz AVR clock with no prescaling
// TCCR1B|= (1 << CS10 ) ;//Start T/C1 at Fcpu with no prescaling (i.e., 16MHz)
OCR1A=1249;//Set CTC compare value to 200 Hz at 16MHz AVR clock with 1/64 prescaling
TCCR1B|= (1 << CS10 )|(1 << CS11 );// Start T/C1 at Fcpu (i.e., 16MHz)
}
// === This is a routine which will be called if an overflow happens in T/C5 ===
ISR(TIMER5_OVF_vect )
{
bigLaps++; //when this runs, you had 65365 pulses counted
}
unsigned long Current_Count=0;//A variable to store the total number of pulses
void loop() {
Current_Count = TCNT5 + bigLaps*65536;
Serial.println(Current_Count); // Print the current number of pulses
delay(1000); // Intervals between each two consecutive prints
}