I need help to create a basic C code AVR project in Atmel Studio 7.0. The MCU I will use is ATtiny44. The project must have a basic main program and some functions. The MCU shall run on the internal 8MHz oscillator at 1MHz (CKDIV8 fuse enabled). There has to be two different sleep functions: one where it wakes up on ext. interrupt (pin change), and one where it wakes up by itself after 1 or 2 seconds (implement possibility to select 1 or 2 seconds). In sleep mode, it is important that the MCU consumes as little power as possible.
This is the functions:
- Go to sleep mode (power-down) and wake up on ext. interrupt (pin change)
- Go to sleep mode (power-down) for 1 or 2 seconds (implement possibility to select 1 or 2 seconds)
- Read 2 ADC channels (ADC setup/ADC read)
- Check pin level (high/low)
- Set pin level (high/low)
- I2C (set device write address, write register address, write data)
- I2C (set device write address, write register address, set device read address, read data)
The main program shall have this sequence:
- Read ADC channel ADC1 (PA1) and store value in a variable called 'adc_1'
- Read ADC channel ADC2 (PA2) and store value in a variable called 'adc_2'
- Check pin PB0 level (high/low)
- Set pin PA0 output high
- Set pin PA3 output low
- Read data from I2C device (device address: "1010101x" (x=R/W))
- Write data to I2C device (device address: "1010101x" (x=R/W))
- if('counter_1' < 10):
- go to sleep mode and wake up after 1 or 2 seconds
- 'counter_1' = 0
- go to sleep and wake up on extern interrupt (PB0)
July 26, 2018
I am looking for freelancers with the lowest rates