Zeitschaltung V1 eingefügt
This commit is contained in:
commit
e6db47d5f5
BIN
V1/Zeitschaltung-3D-Platine.png
Normal file
BIN
V1/Zeitschaltung-3D-Platine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
BIN
V1/Zeitschaltung-Layout.TIF
Normal file
BIN
V1/Zeitschaltung-Layout.TIF
Normal file
Binary file not shown.
BIN
V1/Zeitschaltung-Platine.TIF
Normal file
BIN
V1/Zeitschaltung-Platine.TIF
Normal file
Binary file not shown.
BIN
V1/Zeitschaltung-Platine.png
Normal file
BIN
V1/Zeitschaltung-Platine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
V1/Zeitschaltung-Schaltung.png
Normal file
BIN
V1/Zeitschaltung-Schaltung.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
V1/Zeitschaltung.T3000
Normal file
BIN
V1/Zeitschaltung.T3000
Normal file
Binary file not shown.
1
V1/Zeitschaltung.aps
Normal file
1
V1/Zeitschaltung.aps
Normal file
@ -0,0 +1 @@
|
|||||||
|
<AVRStudio><MANAGEMENT><ProjectName>Zeitschaltung</ProjectName><Created>14-Apr-2012 00:00:11</Created><LastEdit>15-Apr-2012 01:29:24</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>14-Apr-2012 00:00:11</Created><Version>4</Version><Build>4, 19, 0, 730</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Zeitschaltung.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\Doc's\Schaltung\AVR\Zeitschaltung\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATtiny13.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>Zeitschaltung.c</SOURCEFILE><SOURCEFILE>sleep.c</SOURCEFILE><HEADERFILE>sleep.h</HEADERFILE><OTHERFILE>default\Zeitschaltung.lss</OTHERFILE><OTHERFILE>default\Zeitschaltung.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>attiny13</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Zeitschaltung.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=9600000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>E:\Programme\AVR Toolchain\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>E:\Programme\AVR Toolchain\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>Zeitschaltung.c</FileName><Status>1</Status></File00000></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
|
72
V1/Zeitschaltung.c
Normal file
72
V1/Zeitschaltung.c
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/sleep.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "sleep.h"
|
||||||
|
|
||||||
|
uint16_t adc_schlafen() {
|
||||||
|
uint8_t value;
|
||||||
|
uint16_t sum;
|
||||||
|
//sleep_long(1000);
|
||||||
|
ADCSRA |= (1<<ADEN) | (1<<ADSC);
|
||||||
|
while(ADCSRA & (1<<ADSC)) { /* Habe Fertig */ };
|
||||||
|
value = ADCL; //LOWER First
|
||||||
|
value = ADCH; //THEN upper
|
||||||
|
sum = value;
|
||||||
|
ADCSRA &= ~(1<<ADEN);
|
||||||
|
sum *= 30;
|
||||||
|
sum += 1000;
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mosfet_an() {
|
||||||
|
uint16_t sleep = adc_schlafen();
|
||||||
|
PORTB |= (1<<PB0);
|
||||||
|
sleep_long(sleep);
|
||||||
|
PORTB &= ~(1<<PB0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(INT0_vect)
|
||||||
|
{
|
||||||
|
_delay_ms(100);
|
||||||
|
if (!(PINB & (1<<PINB1)) ) { //Ein
|
||||||
|
PORTB |= (1<<PB3);
|
||||||
|
mosfet_an();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
//} else { //Aus
|
||||||
|
while(1) {
|
||||||
|
PORTB |= (1<<PB3);
|
||||||
|
_delay_ms(1000);
|
||||||
|
PORTB &= ~(1<<PB3);
|
||||||
|
_delay_ms(1000);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
//set_sleep_mode(SLEEP_MODE_IDLE);
|
||||||
|
//sleep_mode();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (void) {
|
||||||
|
cli();
|
||||||
|
DDRB |= (1<<PB0) | (1<<PB3);
|
||||||
|
PORTB |= (1<<PB1);
|
||||||
|
GIMSK |= (1<<INT0);
|
||||||
|
MCUCR |= (1<<ISC01);
|
||||||
|
|
||||||
|
ADMUX = 0x00;
|
||||||
|
ADMUX |= (1<<REFS0) | (1<<ADLAR) | (1<<MUX1);
|
||||||
|
sei();
|
||||||
|
while(1){
|
||||||
|
PORTB &= ~(1<<PB0);
|
||||||
|
//set_sleep_mode(SLEEP_MODE_IDLE);
|
||||||
|
//sleep_mode();
|
||||||
|
//_delay_ms(2000);
|
||||||
|
PORTB |= (1<<PB3);
|
||||||
|
_delay_ms(100);
|
||||||
|
PORTB &= ~(1<<PB3);
|
||||||
|
_delay_ms(1500);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
24
V1/default/Zeitschaltung.hex
Normal file
24
V1/default/Zeitschaltung.hex
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
:1000000009C025C00DC00CC00BC00AC009C008C083
|
||||||
|
:1000100007C006C011241FBECFE9CDBF47D0A6C080
|
||||||
|
:10002000EFCF86B1806C86B93699FECF84B185B1A9
|
||||||
|
:10003000379890E06EE170E087D09C0128513C4FEA
|
||||||
|
:10004000C9010895EEDFC09A62D0C09808951F924A
|
||||||
|
:100050000F920FB60F9211242F933F934F935F93FC
|
||||||
|
:100060006F937F938F939F93AF93BF93EF93FF9380
|
||||||
|
:100070008FEF9DEEA2E081509040A040E1F700C0DC
|
||||||
|
:100080000000B19902C0C39ADDDFFF91EF91BF91EB
|
||||||
|
:10009000AF919F918F917F916F915F914F913F9120
|
||||||
|
:1000A0002F910F900FBE0F901F901895F89487B363
|
||||||
|
:1000B000896087BBC19A8BB780648BBF85B782602C
|
||||||
|
:1000C00085BF17B887B1826687B97894C098C39AFC
|
||||||
|
:1000D0008FEF9DEEA2E081509040A040E1F700C07C
|
||||||
|
:1000E0000000C3988FEF91EFABE281509040A040A9
|
||||||
|
:1000F000E1F700C00000EACF07C0EFE5F9E0319773
|
||||||
|
:10010000F1F700C0000081508823B9F7089507C0B7
|
||||||
|
:10011000EFE5F9E03197F1F700C000000197009793
|
||||||
|
:10012000B9F7089505C093E09A95F1F70000815062
|
||||||
|
:100130008823C9F7089505C023E02A95F1F7000048
|
||||||
|
:1001400001970097C9F708955527002480FF02C042
|
||||||
|
:10015000060E571F660F771F6115710521F09695E2
|
||||||
|
:100160008795009799F7952F802D0895F894FFCFE4
|
||||||
|
:00000001FF
|
39
V1/sleep.c
Normal file
39
V1/sleep.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "sleep.h"
|
||||||
|
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
void sleep(char ms) //8bit
|
||||||
|
{
|
||||||
|
while(ms > 0)
|
||||||
|
{
|
||||||
|
_delay_ms(1);
|
||||||
|
ms--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sleep_long(uint16_t ms) //16bit
|
||||||
|
{
|
||||||
|
while(ms > 0)
|
||||||
|
{
|
||||||
|
_delay_ms(1);
|
||||||
|
ms--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void usleep(char us) //8bit
|
||||||
|
{
|
||||||
|
while(us > 0)
|
||||||
|
{
|
||||||
|
_delay_us(1);
|
||||||
|
us--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void usleep_long(unsigned short int us) //16bit
|
||||||
|
{
|
||||||
|
while(us > 0)
|
||||||
|
{
|
||||||
|
_delay_us(1);
|
||||||
|
us--;
|
||||||
|
}
|
||||||
|
}
|
13
V1/sleep.h
Normal file
13
V1/sleep.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _SLEEP_H_
|
||||||
|
#define _SLEEP_H_
|
||||||
|
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
void usleep(char ms); //8bit
|
||||||
|
void usleep_long(unsigned short int ms); //16bit
|
||||||
|
|
||||||
|
void sleep(char ms); //8bit
|
||||||
|
void sleep_long(uint16_t ms); //16bit
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
1
V1/zeitschaltung.aws
Normal file
1
V1/zeitschaltung.aws
Normal file
@ -0,0 +1 @@
|
|||||||
|
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATtiny13"/><Files><File00000 Name="D:\Doc's\Schaltung\AVR\Zeitschaltung\Zeitschaltung.c" Position="189 67 676 328" LineCol="33 20" State="Maximized"/></Files></AVRWorkspace>
|
BIN
Z-Diode.ms11
Normal file
BIN
Z-Diode.ms11
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user