Na gut, die Delays scheinen tatsächlich ziemlich buggy zu sein, dann schmeiß ich die gerne raus (das Buch behalte ich noch ein paar Tage...
.
Den Quelltext habe ich jetzt schon ein wenig reduzieren können, die aktuelle Version werde ich jetzt hier posten und weiterhin um Hilfe mit den Interrupts bitten - denn das klappt alles noch nicht....
Code:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/sleep.h>
#include <inttypes.h>
#include <avr/signal.h>
#include <inttypes.h>
#include "main.h"
#include "lcd_functions.h"
#include "lcd_driver.h"
#include <avr/delay.h>
#define pLCDREG_test (*(char *)(0xEC))
volatile PGM_P statetext;
void PinChangeInterrupt(void)
{
statetext = PSTR("wand");
LCD_puts_f(statetext, 1);
LCD_Colon(0);
}
SIGNAL(SIG_PIN_CHANGE0)
{
PinChangeInterrupt();
}
SIGNAL(SIG_PIN_CHANGE1)
{
PinChangeInterrupt();
}
/*****************************************************************************
*
* Function name : main
*
* Returns : None
*
* Parameters : None
*
* Purpose : Contains the main loop of the program
*
*****************************************************************************/
int main(void)
{
LCD_Init();
DDRB = 0x00; // set Port B for input
PORTB = 0xFF;
// Enable pin change interrupt on PORTB
PCMSK1 = (1<<PCINT12)|(1<<PCINT11)|(1<<PCINT10)|(1<<PCINT9);
EIMSK = (1<<PCINT1);
statetext = PSTR("1");
// Program initalization
sei();
while (1) // Main loop
{
statetext = PSTR("1");
LCD_puts_f(statetext, 1);
LCD_Colon(0);
} //End Main loop
return 0;
}
Weiterhin vielen Dank für eure Hilfe,
cheers,
Flo.
Lesezeichen