AVR Studio, Atmega8, C ++, CTC timer

Hello, I have a problem with my code. Namely, if my program is used in the ISR will my display of comic characters. Since my debugger does not work I can not move to full and I'm just not there anymore. Here is my code:

#define F_CPU 3686400 #include <avr/io.h> #include <avr/delay.h> //Delays //Muss über der lcdlib.h stehen sonst fehler da man delay in der lcdlib.h braucht #include <avr/interrupt.h> #include <arndt/lcdlib.h> //Notwendig für das LCD-Display // Befehle für das Display ISR (TIMER1_COMPA_vect); int main(void) { lcdInit(); //Iinitialisierung DDRC = 0x00; //Eingang PORTC = 0xFF; //Pull-up int Pumpe; Pumpe = 0; //Pumpe Nullsetzten, wird im Hauptprogramm gesetzt und Definiert ** while(1) { lcdGoto(2,1);lcdWrite("1"); if (!(PINC&0b000010)) //Wenn die If-bedingung drin ist Zeigt das LcdDisplay lustige Zeichen an nach dem es wahr wurde //Zum kontrolierten Start des Programms { lcdGoto(1,14);lcdWrite("Q"); // If (Pumpe = 1) //Soll erst gemacht werden, wenn Pumpe = 1, 5 sec lang an ist //Wir später gemacht // { //Timer0 konfigurieren TCCR1A = (1<<WGM10); //CTC Modus aktiv TCCR1B |=(1<<CS11)|(0<<CS10); //Prescaler8 // (1<<CS10)|(1<<CS11) Prescaler 64 // TCNT1 = 0; //Timer Intitialisieren //Keine sichtbaren Veränderungen // TCCR1B |= 0x08; //Modus: Zählen bis Vergleichswert //Überflüssig OCR1A = 460800-1; //Vergleichswert speichern 5sec //Berechnungsformel((Frequenz/Prescaler)/Zeit in ms) TIMSK|= 0x10; // Interrupt bei vergleichswert sei(); //Global Interrupts erlauben // } lcdGoto(1,15);lcdWrite("W"); //Hier kommt das Programm nie hin, WARUM }** }


ISR (TIMER1_COMPA_vect) //Interrupt bei Vergleichswert CompA //Muss sich den Wert aus Pumpe mitnehmen { cli(); //Interrupts sperren DDRC = 0x00; //Eingang PORTC = 0xFF; //Pull-up int Pumpe; //Test Variable für das Hauptprogramm // lcdClear(); lcdGoto(1,1);lcdWrite("Pumpenfehler"); if(!(PINC = 0x01)) //Test { Pumpe = 1; //Pumpe an //Zustand = 1; } sei(); //Interrupts erlauben

} // (Return pump) Must the value in return pump in pump

Image with the sign still follows and schonmal Thanks in advance.


The best answer

The two ** before while (1) and after} (from while (1) do not do not belong. White but how I can change it in the question :)

Date: 2019-08-11 Views: 0

Related articles

  • Fitness! Go for a year in the studio and train 3 times a week Full (Beatzeps, triezeps, back, shoulder, belly) it Will in three days? 2012-04-12

    --answer-- I want to divide this whole areas to three days and received intensiever on the various muscle groups. How is the division Sinnoll? * Biceps, triceps Your body has no legs and no chest? I'm sorry: / Nice that you still do not give up !! 1:

  • AVR Register in Variable 'store' 2013-06-29

    I work with AVR Studio and write a C / C ++ program and I would pay a register address in a structure? I hope this brief information rich and thank you in advance. Lg SKneb --answer-- it does not work; the compiler decides itself how the registers ar

  • How to build muscle fast on'm logged in fitnes studio? 2012-04-14

    --answer-- Are logged in the studio, but how about time to go back instead of here to ask this question;). How so absolutely "fast"?

  • Am I right to terminate at the gym, when you have no more time? 2012-04-19

    Good evening, dear community, I am very athletic, I of course also go to a gym, which I'm really happy (am there now nearly a year) but my schedule has changed this year drastically and next to the school, I have a part-time job, so I do not time lon

  • Help! Girlfriend needs time to think? : / 2013-04-13

    Namely, it is as it is above. My girlfriend and I (both 19) have not been together that long but have the last 3 months, actually just "perched successive". Until 3 weeks ago everything was super both had vacation and have made each other a lot.

  • Camtasia Studio can audio data does not reflect on the timeline? 2014-04-02

    Hello, I use Camtasia studio for a long time without any problems, but then came a message that states: "We are sorry! Camtasia Stdio could not play the audio from the timeline. Please save the project and open it again. (Error Code 0x8889000f: Unkno

  • FL Studio click comical how do you get that away? 2014-08-06

    Hello all together, for about a year now I work with FL Studio. For some time now I have such a weird clicking on each 1st grade. Even if I disable the playlist all tracks it's still there. The master channel in the mixer is indeed appears a bit, but

  • Beats Studio 2.0 no longer go to 2015-01-21

    Got my beats studio 2.0 jz times kommplett gemscht empty to really nothing more was splashing around, they've then fully charged which my points also show the. Now I put the plug purely to hear music and it only flashes red and does not go to ... Why

  • FL Studio 11 up / down pitching without the slowing each other down? 2015-01-28

    Is there a way in FL Studio 11 higher / lower to pitch without the speed slows down or speeds up is? PS: Admins do not need to delete this perfectly normal question, thank you. --answer-- There are in FL Studio is a function "Time Stretching". W



Copyright (C) 2019 m3tch.com, All Rights Reserved.

M3tch all rights reserved.

processed in 0.635 (s). 10 q(s)