What does the Peripheral Bus do?
Connects all of the peripherals, but with a slower connection
What are the 4 types of memory in the PIC32?
- RAM - 128 kB
- Flash - 512 kB
- SFRs - 1 MB
- Boot Flash - 12 kB
Why is C programming used with microcontrollers?
C is a lower level language that works directly with the hardware. Has the right data types as well.
What number systems are used?
How are number systems represented?
Number systems are represented the same way in the memory, but we as programmers decide how to represent it. Example: 0101 means something different in decimal and binary
What are the different Data Types?
- [unsigned] char - 8 bits
- [unsigned] short - 16 bits
- [unsigned] int - 32 bits
- [unsigned] long - 32 bits
- [unsigned] long long - 64 bits
- some expressions are more important than others:
- a*b+c; //(a*b) will always be evaluated first
- c+a*b; //(a*b) will always be evaluated first
- can evaluate right to left or left to right:
- a+b+c; //evaluates a+b and then +c, left -> right
- a++; //reads right -> left
A | BIT_5 - sets bit 5 in A to 1
(A & ~BIT_5) - clears bit 5 in A
- (A ^ BIT_5) - toggles bit 5 in A
Shift X 3 bits to the right
(X >> 3)
Shift X 3 bits to the left
(3 << X)
How many bits do PORT_A....PORT_G have?
Logic high (1) means tri-state
Direction (input or output)
- Actual port value when written to.
- Returns what was last programmed to the port when read.
What does PLib stand for?
Set a specific pin as an input
SetPinsDigitalIn(Port, Bit Mask)
Set a specific pin as an output
SetPinsDigitalOut(Port, Bit Mask)
Write all bits in a port
Write only the masked bit
- PORTSetBits(Port, Mask)
- PORTClearBits(Port, Mask)
- PORTToggleBits(Port, Mask)
Read bits from a port
What is the term used for dealing with the jitter when pressing a button?
"Index" number for where to read the interrupt code from.
Priority level of the interrupt. If two interrupts are triggered at the same time, the one with the higher Interrupt Priority will execute.
Priority level of an interrupt. Only used when two interrupts are triggered at the same time that have the same Interrupt Priority. The one with the higher Interrupt Subpriority will execute.
Interrupt Enable Bit
Enables the interrupt to be triggered.
Turned on to trigger an interrupt. When the interrupt has finished running, must be reset (if not, the interrupt will not be triggered again.)
What does it mean for a counter to be "Prescaled"?
When counting longer times, the counter must be prescaled, meaning that for every "n" number of counts, up the counter by one
What is a timer "Period"?
generate an interrupt when we hit the period
What is the difference between "Input Capture" and "Output Compare"?
- Input capture triggers the interrupt when a port's bit goes from low->high or high->low.
- Output Compare checks to see if the timer is equal to the OC, and if so, triggers a change