|
GPS/GSM/GPRS modem Watchdog monitor. GSM modem watchdog timer, the application to watch the status of the satellite modem. Based on ATtiny13V microcontroller. Also contains an power supply (LM5576 or LM25576 IC) and battery charger (LTC4054) circuits.

Schematic diagram. Click to enlarge.
Watchdog Monitor PCAD2006 Schematic file. Click to download.

Computer interface Schematic diagram. Click to enlarge.
Computer interface PCAD2006 Schematic file. Click to download.
Source code (IAR Embedded Workbench):
#include "iotiny13.h"
#include <inavr.h>
#define bit(n) (1 << (n))
#define setbit(p,n) (p|=bit(n))
#define clrbit(p,n) (p&=~bit(n))
#define invbit(p,n) (p=p^bit(n))
#define tstbit(p,n) (p&bit(n))
#define MasterClock 9600000
#define delay_us(c) __delay_cycles(MasterClock/1000000*c)
#define delay_ms(c) __delay_cycles(MasterClock/1000*c)
volatile unsigned int SecondCounter = 0;
#pragma vector = INT0_vect
__interrupt void INT0_vect_Interrupt(void)
{
SecondCounter = 0;}
void main (void)
{
PORTB = 0x00; DDRB = 0x02;
CLKPR = 0x80; CLKPR = 0x00;
GIMSK = 0x40; MCUCR = 0x01;
GIFR = 0x40;
GIMSK=0x60;
MCUCR=0x01;
PCMSK=0x04;
GIFR=0x60;
WDTCR = 0x39; WDTCR = 0x29;
asm ("sei"); setbit(PORTB, 1); delay_ms(1000); __watchdog_reset(); clrbit(PORTB, 1); delay_ms(2000); __watchdog_reset(); setbit(PORTB, 1);
while (1)
{
delay_ms(1000); SecondCounter++;
__watchdog_reset(); if (SecondCounter > 3600) { setbit(PORTB, 1); delay_ms(1000); __watchdog_reset(); clrbit(PORTB, 1); delay_ms(2000); __watchdog_reset(); setbit(PORTB, 1);
SecondCounter = 0; }
}
}
|