AVR C
- tags: #C Programming #Embedded programming Programming/codingArduino
- Resources
- Embedded C basics
- AVR C Basics Human hard drive, detail explanation, register setting, timers, interrupts.
- AVR Interrupts library
- PWM.h PWM library
- AVR Tutorials Mikrocontrollers.net
- AVR interrupts
- AVR PWM
- Notes
- AVR programmers communicate with SPI, which is MISO, MOSI, SCK interface.
- If you look at the data sheet there are PC,PD,PB ports. Eg PB7, Port B 7, Each port is a byte of data and each of these numbers correspond to a bit in the byte that is the port.
- The register is a specific portion in the memory that serves a function in the micro controller.
- Registers
- Registers are a collection bits which represent the current state.
- DDRx
- Direction register that sets the port as the input or the output.
- PORTx
- PORTx sets the state of the pin, either on or off
- Eg - Turning PB0 on and off
- PB0 is the zeroth bit in the B port, ie DDRB 0000001 sets PB0 as output PORTB 00000001 turns the pin high.
- In Hexadecimal DDRB 0x01, PORTB 0x01
- PINx
- These are input registers are dynamically updated, it will receive values based on the state of all the pins in the register.
- When pulling the state of a single bit of the PIN register, we need a Mask variable. Its a variable of the same size as the number of bits you are comparing it to. Do an AND operation with the Mask.
-
Why use a mask variable?
- If we want to check the state of a pin, but don’t know the condition of all the other pins, then we can’t find an exact match if we just do a Boolean operation to compare the state of the the pin. So we mask out all other pins and the output would just return the state of the pin we are interested in.
- Bit Shifting
- Bit shifting is an easy method to put values into the registers
-
Normally if you write a value to an output PORT it will turn the pin ON/OFF. But if you write a vlaue to the Input PORT, you will turn ON/OFF the internal pullups.
-
tags: #AVR C Hexadecimal
-
Tags Arduino AVR C C Programming
-
tags: #AVR C
-
tags: Arduino AVR C C Programming
- AVR C
Notes mentioning this note
Arduino
tags MicrocontrollerProgramming/codingAVR C Resources ATtiny avr-1 series Atmega UPDI interface Mordern AVR UPDI series resistors SAMD11 21 Fabduino tutorial Jake...
AVR C
tags: #C Programming #Embedded programming Programming/codingArduino Resources Embedded C basics AVR C Basics Human hard drive, detail explanation, register setting,...
Binary
tags: #AVR C Hexadecimal
Resources
Binary and File types
Computer Architecture
Bits of bytes theory of computer science
Courses
Robotics Applied Robotic Stanford CS235 Fundamentals of Design Languages German Fabrication Making Prototypes Programming/coding AVR C Edx Single variable calculus...
Electronics
tags: Circuit Design Resources All about Circuits: Electronics Basics Electronics for Geeks Physics Videos by Eugene #Youtube courses watch Electronics...
Hexadecimal
tags: #AVR C Hexadecimal tutorial Binary to HEx Summary Long binary numbers are difficult to comprehend, hence hexadecimal with base...