Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 311 → Rev 312

/MikroBlink/Blitzdings/Blitzdings.pnproj
1,0 → 0,0
<Project name="Blitzdings"><File path="lprg.c"></File><File path="makefile"></File><File path="timer.c"></File><File path="timer.h"></File><File path="main.h"></File><File path="main.c"></File><File path="lprg.h"></File></Project>
<Project name="Blitzdings"><File path="lprg.c"></File><File path="makefile"></File><File path="timer.c"></File><File path="timer.h"></File><File path="main.h"></File><File path="main.c"></File><File path="lprg.h"></File><File path="analog.c"></File><File path="analog.h"></File></Project>
/MikroBlink/Blitzdings/Hexfiles/Blitzdings_MEGA8.hex
1,84 → 1,95
:100000004EC068C0CBC066C065C064C063C062C07B
:1000100061C08EC15FC05EC05DC05CC05BC05AC0C5
:1000200059C058C057C0E5C0E6C0E7C0E8C0E9C045
:10003000EAC0EBC0ECC0EDC0DAC0F5C0F6C0F7C056
:10004000F8C0F9C0FAC0FBC0FCC0FDC0EAC05CC18A
:1000500058C15CC15BC15AC159C158C14FC156C1D9
:1000600055C154C153C152C151C150C144C14EC107
:100070004DC14CC13DC139C149C148C147C146C14B
:1000800031C144C143C12BC141C140C13FC13EC187
:100090003DC13CC13BC13AC139C138C11DC1112468
:100000004EC068C07DC066C065C064C063C062C0C9
:1000100061C0C3C15FC05EC05DC05CC05BC05AC090
:1000200059C058C057C01AC11BC11CC11DC11EC137
:100030001FC120C121C122C10FC12AC12BC12CC1A6
:100040002DC12EC12FC130C131C132C11FC191C1DB
:100050008DC191C190C18FC18EC18DC184C18BC131
:100060008AC189C188C187C186C185C179C183C15F
:1000700082C181C172C16EC17EC17DC17CC17BC1A3
:1000800066C179C178C160C176C175C174C173C1DF
:1000900072C171C170C16FC16EC16DC152C11124F5
:1000A0001FBECFE5D4E0DEBFCDBF11E0A0E6B0E0DB
:1000B000E2E2F4E002C005900D92A435B107D9F751
:1000C00011E0A4E5B1E001C01D92A438B107E1F749
:1000D0001AD0A6C195CFE0915401F0915501EE0FD1
:1000E000FF1FE75BFE4F80819181AFD0809154016B
:1000F00090915501019665E070E07ED19093550195
:100100008093540108950F931F93CF93DF9385E05D
:1001100087BB8EE384BB80EF81BB939A80E88BBF63
:1001200084E085BFC29885B385BB82B382BBC0988B
:100130003ED1D1DF80E197E240D18C0188EE93E09F
:100140003CD1EC0178948091820190918301892BBC
:10015000B1F4C8013BD18823D9F4CE0137D188232B
:1001600091F388B391E0892788BB88EE93E025D18D
:10017000EC018091820190918301892B51F31092BF
:1001800083011092820178D0C80120D1882329F3FD
:10019000A2DF80E197E211D18C01DFCF1F920F9295
:1001A0000FB60F9211242F933F934F935F936F934A
:1001B0007F938F939F93AF93BF93EF93FF938BDFC7
:1001C000FF91EF91BF91AF919F918F917F916F912F
:1001D0005F914F913F912F910F900FBE0F901F9005
:1001E0001895FC010A9720F4ED5EFF4F0994979A49
:1001F0000895C29A0895A99A0895AA9A0895AB9A63
:100200000895AC9A0895AD9A0895949A0895959A90
:100210000895969A0895FC010A9720F4E35EFF4F33
:10022000099497980895C2980895A9980895AA984E
:100230000895AB980895AC980895AD980895949852
:1002400008959598089596980895CF93DF93009711
:1002500081F0E6E5F1E0DC01EF01649610821286A0
:100260008D919D9189939993319681E0E036F807BD
:10027000A9F7DF91CF910895EF92FF920F931F930B
:10028000CF93DF93C6E5D1E084E1E82EF12CEC0EAC
:10029000FD1E00E010E003C08150888337C08881D4
:1002A0008823D1F7F701A081B1818A85FD01E80F8C
:1002B000F11DE0818F5F8A87A80FB11D8C91882383
:1002C00009F41A868E2F90E0FC01FA97E832F105C6
:1002D000E8F4E95DFF4F0994C8019DDF17C081E391
:1002E000888314C083E6888311C083E188830EC0AD
:1002F0008DE188830BC089E0888308C0C80171DF65
:1003000005C084E0888302C081E088830F5F1F4FAF
:10031000219682E090E0E80EF91E0A30110509F0FE
:10032000BECFDF91CF911F910F91FF90EF90089575
:100330001F920F920FB60F9211245F936F937F93CA
:100340008F939F93AF93BF93809181018F5F809331
:100350008101809180018150809380018F3FD9F489
:1003600083E08093800180917E0190917F010196CE
:1003700090937F0180937E0180917E0190917F0117
:100380006AE070E039D0892B31F481E090E09093FD
:10039000830180938201BF91AF919F918F917F9153
:1003A0006F915F910F900FBE0F901F90189582E094
:1003B00083BF89B7816089BF089520917E01309104
:1003C0007F0121503040820F931F089520917E01BC
:1003D00030917F01821B930B892F9927807890E0C1
:1003E0000895CF93DF93E9DFEC01CE01EFDF88239F
:1003F000E1F3DF91CF910895AA1BBB1B51E107C028
:10040000AA1FBB1FA617B70710F0A61BB70B881FA4
:10041000991F5A95A9F780959095BC01CD01089533
:02042000FFCF0C
:1004220041006100413A6149413A6149413A6153AF
:1004320056002E004E4E61494153534E4E4E004ED1
:1004420061494153534E4E4E4E004E413A6149412D
:100452003A6149413A614D530061494153534E4E0D
:100462004E4E4E004E4E4E61494153534E4E006425
:10047200007200740072007F008A0072009900729C
:1004820000A4006200620062006200620062006218
:100492000062006200620060006000600060006054
:1004A2000060006000600060006000614D414D002E
:1004B200EB00EB00EB00EB00EB00EB00EB00EB00E2
:1004C200EB00EB00612E412E00613A413A00613BA4
:1004D200413B006149414900614E414E00614D4935
:1004E200414D490061564156006156494156490005
:1004F2006153415300040109010E0113011801EB7C
:10050200001D01240129013001D700AF00C300F012
:0405120000350100AF
:1000B000E6EBF4E002C005900D92AA37B107D9F73C
:1000C00011E0AAE7B1E001C01D92AA3AB107E1F739
:1000D0003AD0F0C195CF80917A0190917B01019641
:1000E00063E070E0D3D1FC0190937B0180937A01AF
:1000F000EE0FFF1FED58FE4F80819181DBD00895F8
:100100001F920F920FB60F9211242F933F934F938C
:100110005F936F937F938F939F93AF93BF93EF936F
:10012000FF93D9DFFF91EF91BF91AF919F918F9195
:100130007F916F915F914F913F912F910F900FBEE3
:100140000F901F901895AF92BF92CF92DF92EF92CF
:10015000FF920F931F93CF93DF9385E087BB8EE3CE
:1001600084BB80EF81BB939A80E88BBF84E085BF1E
:10017000C29885B385BB82B382BBC0984DD1E09154
:100180007A01F0917B01EE0FFF1FED58FE4F808149
:10019000918190D080E197E245D17C0188EB9BE092
:1001A00041D18C0188EE93E03DD1EC0178942FE1B0
:1001B000A22E21E0B22E8091A8019091A901892B55
:1001C000F1F4CE0138D1882319F5C80134D1882340
:1001D00041F084EBC816D10454F588EB9BE022D1A2
:1001E0008C01C70128D1882331F380E197E21AD12D
:1001F0007C018091A8019091A901892B11F31092A3
:10020000A9011092A8016DD0CE0115D18823E9F281
:100210002DD16C0184EBC816D104ACF088B391E009
:10022000892788BB88EE93E0FDD0EC01CECFE0912A
:100230007A01F0917B01EE0FFF1FED58FE4F808198
:10024000918138D0CACFC50135D0E8CFFC010A97DB
:1002500020F4ED5EFF4F0994979A0895C29A08958D
:10026000A99A0895AA9A0895AB9A0895AC9A089508
:10027000AD9A0895949A0895959A0895969A089536
:10028000FC010A9720F4E35EFF4F099497980895C4
:10029000C2980895A9980895AA980895AB980895CA
:1002A000AC980895AD9808959498089595980895F8
:1002B00096980895CF93DF93009781F0ECE7F1E0F3
:1002C000DC01EF016496108212868D919D918993D5
:1002D0009993319681E0E638F807A9F7DF91CF913D
:1002E0000895EF92FF920F931F93CF93DF93CCE784
:1002F000D1E084E1E82EF12CEC0EFD1E00E010E0D0
:1003000003C08150888337C088818823D1F7F701E3
:10031000A081B1818A85FD01E80FF11DE0818F5F29
:100320008A87A80FB11D8C91882309F41A868E2F15
:1003300090E0FC01FA97E832F105E8F4E95DFF4F3F
:100340000994C8019DDF17C081E3888314C083E648
:10035000888311C083E188830EC08DE188830BC040
:1003600089E0888308C0C80171DF05C084E0888304
:1003700002C081E088830F5F1F4F219682E090E0EA
:10038000E80EF91E0A30110509F0BECFDF91CF91BA
:100390001F910F91FF90EF9008951F920F920FB64B
:1003A0000F9211245F936F937F938F939F93AF93DB
:1003B000BF938091A7018F5F8093A7018091A601D1
:1003C00081508093A6018F3FD9F483E08093A601EA
:1003D0008091A4019091A50101969093A50180932D
:1003E000A4018091A4019091A5016AE070E04ED033
:1003F000892B31F481E090E09093A9018093A801CA
:10040000BF91AF919F918F917F916F915F910F906D
:100410000FBE0F901F90189582E083BF89B781604F
:1004200089BF08952091A4013091A5012150304049
:10043000820F931F08952091A4013091A501821B82
:10044000930B892F9927807890E00895CF93DF93BD
:10045000E9DFEC01CE01EFDF8823E1F3DF91CF91FB
:10046000089586EA86B917B8369A089590EC97B938
:1004700010BE83ED86B9349A97B9369A349BFECF75
:1004800016B888E080BF84B195B10895AA1BBB1B44
:1004900051E107C0AA1FBB1FA617B70710F0A61B84
:1004A000B70B881F991F5A95A9F780959095BC01A5
:0604B000CD010895FFCF0D
:1004B60041006100413A6149413A6149413A61531B
:1004C60056002E004E4E61494153534E4E4E004E3D
:1004D60061494153534E4E4E4E004E413A61494199
:1004E6003A6149413A614D530061494153534E4E79
:1004F6004E4E4E004E4E4E61494153534E4E006491
:10050600007200740072007F008A00720099007207
:1005160000A400410064007200C3007200C3008A98
:10052600007200C3007200C30062006200620062D3
:1005360000620062006200620062006200600060A9
:1005460000600060006000600060006000600060A5
:1005560000614D414D00010101010101010101014F
:100566000101010101010101010161494149001A2D
:10057600011A011A011A011A011A011A011A011A9D
:10058600011A01612E412E00613A413A00613B4158
:100596003B00614E414E00614D49414D4900615657
:1005A6004156006156494156490061534153003353
:1005B6000138013D011A014201010147014E015373
:0A05C600015A01C500ED00D9000044
:00000001FF
/MikroBlink/Blitzdings/analog.c
0,0 → 1,36
/*############################################################################
 
############################################################################*/
 
#include "main.h"
 
//############################################################################
//Init ADC
void ADC_Init(void)
 
{
ADCSRA = 0xA6; // Free Run & 1MHZ
ADMUX = 0; // Kanal 0
ADCSRA |= 0x40; // Start
}
 
 
 
//############################################################################
//Strom Analogwerte lesen
unsigned int getVcurr()
 
{
ADMUX = 0 | 0xC0; // Kanal 0, interne Referenz
SFIOR = 0x00; // Analog Comperator aus
ADCSRA = 0xD3; // Converter ein, single
ADCSRA |= 0x10; // Ready löschen
ADMUX = 0 | 0xC0; // Kanal 0, interne Referenz
ADCSRA |= 0x40; // Start
while (((ADCSRA & 0x10) == 0));
ADCSRA = 0x00;
SFIOR = 0x08; // Analog Comperator ein
return(ADCW);
}
 
 
/MikroBlink/Blitzdings/analog.h
0,0 → 1,5
 
extern void ADC_Init(void);
unsigned int getVcurr(void);
 
 
/MikroBlink/Blitzdings/main.c
17,6 → 17,7
#include "main.h"
#include "timer.h"
#include "analog.h"
#include "lprg.h"
 
/* Strings zum definieren von Dauer-Ein Dauer-Aus */
37,7 → 38,7
 
// Rot+Grün blitzen dreimal kurz, zeitlich leicht versetzt, alle 1,5s
// 2 weisse und 2 blaue LEDs sind an und gehen alle 3s reihum kurz aus
char *led_posflash[] = {
char *led_posflash1[] = {
"A:aIA:aIA:aSV", // LED #1 rot
".", // LED #2
"NNaIASSNNN", // LED #3 blau
50,7 → 51,21
"NNNaIASSNN" // LED #10 blau
};
 
// dasselbe, nur sind w/b dauer-an
char *led_posflash[] = {
"A:aIA:aIA:aSV", // LED #1 rot
".", // LED #2
"A", // LED #3 blau
".", // LED #4
"A", // LED #5 weiss
"NA:aIA:aIA:aMS", // LED #6 grün
".", // LED #7
"A", // LED #8 weiss
".", // LED #9
"A" // LED #10 blau
};
 
 
char *led_aus[] = {
l_off, // LED #1 rot
l_off, // LED #2 blau
91,6 → 106,20
"aMAM" // LED #10
};
 
// low Volatage Warning: alle LEDs toggeln synchron, 100ms Leucht/Aus-Dauer
char *led_lowVolt[] = {
"aIAI", // LED #1 rot
"aIAI", // LED #2 blau
"aIAI", // LED #3 blau
"aIAI", // LED #4
"aIAI", // LED #5 weiss
"aIAI", // LED #6 grün
"aIAI", // LED #7
"aIAI", // LED #8 weiss
"aIAI", // LED #9
"aIAI" // LED #10
};
 
// alle LEDs toggeln mit verschiednen Zykluszeiten
char *led_flash2[] = {
"a.A.", // LED #1 rot
107,15 → 136,15
 
 
// Hier die zu verwendenden LichtProgramme einfach eintragen.
void *modes[]= { led_an, led_posflash, led_aus, led_flash1, led_flash2 };
 
int current = 0;
void *modes[]= { led_posflash, led_an, led_aus };
 
void nextMode() {
 
static int current = 0;
current = ++current % (sizeof(modes)/sizeof(void *));
lprg_init(modes[current]);
current = ++current % (sizeof(modes)/sizeof(void *));
 
}
 
ISR(INT1_vect)
129,7 → 158,8
 
int main() {
 
int tim10s, tim1s;
int tim1s, tim3s, tim10s;
int Vcurr;
// Ports einstellen
// Pin B |7|6|5|4|3|2|1|0
158,10 → 188,13
STATUS_ON;
 
Timer_Init();
nextMode();
 
lprg_init(modes[current]);
tim10s = SetDelay(10000);
tim3s = SetDelay(3000);
tim1s = SetDelay(1000);
sei(); //interrupts einschalten
 
while (1) {
171,14 → 204,32
lprg_step(); // next step in light prog
}
 
if(CheckDelay(tim10s)) { // alle 10 sec programm wechseln
nextMode();
tim10s = SetDelay(10000);
}
if(CheckDelay(tim1s)) { // alle 1 sec STatus-LED toggeln
// 1s-Task: Status-LED toggeln, Spannung checken
if(CheckDelay(tim1s)) {
Vcurr = getVcurr();
if(Vcurr < 180) {
lprg_init(led_lowVolt);
}
STATUS_TOGGLE;
tim1s = SetDelay(1000);
}
 
// 3s-Task: Unterspannungswarnung ggf. zurücknehmen
if(CheckDelay(tim3s)) {
if(Vcurr>=180) {
lprg_init(modes[current]);
}
tim3s = SetDelay(3000);
}
 
// 10s-Task: DEMO: programm wechseln
if(CheckDelay(tim10s)) {
// nextMode();
tim10s = SetDelay(10000);
}
 
 
 
}
 
}
/MikroBlink/Blitzdings/makefile
59,7 → 59,7
 
# If there is more than one source file, append them above, or modify and
# uncomment the following:
SRC = main.c lprg.c timer.c
SRC = main.c lprg.c timer.c analog.c