OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_diligent_s3board/] [software/] [leds/] [main.c] - Diff between revs 84 and 212

Show entire file | Details | Blame | View Log

Rev 84 Rev 212
Line 6... Line 6...
*/
*/
void delay(unsigned int c, unsigned int d) {
void delay(unsigned int c, unsigned int d) {
  volatile int i, j;
  volatile int i, j;
  for (i = 0; i<c; i++) {
  for (i = 0; i<c; i++) {
    for (j = 0; j<d; j++) {
    for (j = 0; j<d; j++) {
      nop();
      __nop();
      nop();
      __nop();
    }
    }
  }
  }
}
}
 
 
/**
/**
This one is executed onece a second. it counts seconds, minues, hours - hey
This one is executed onece a second. it counts seconds, minues, hours - hey
it shoule be a clock ;-)
it shoule be a clock ;-)
it does not count days, but i think you'll get the idea.
it does not count days, but i think you'll get the idea.
*/
*/
volatile int irq_counter, offset;
volatile int irq_counter;
 
volatile INT8U offset;
 
 
wakeup interrupt (WDT_VECTOR) INT_Watchdog(void) {
wakeup interrupt (WDT_VECTOR) INT_Watchdog(void) {
 
 
  irq_counter++;
  irq_counter++;
  if (irq_counter == 300) {
  if (irq_counter == 300) {
    irq_counter = 0;
    irq_counter = 0;
    offset = (offset+1) % 20;
    offset = (offset+1) % 20;
  }
  }
  DispStr  (offset, "OPENMSP430 IN ACTION    ");
  DispStr  (offset, (INT8U *) "OPENMSP430 IN ACTION    ");
}
}
 
 
 
 
/**
/**
Main function with some blinking leds
Main function with some blinking leds
*/
*/
int main(void) {
int main(void) {
 
 
  int i;
  int i;
    int o = 0;
    int o = 0;
 
 
    irq_counter = 0;
    irq_counter = 0;
    offset      = 0;
    offset      = 0;
 
 
    WDTCTL = WDTPW | WDTHOLD;          // Disable watchdog timer
    WDTCTL = WDTPW | WDTHOLD;          // Disable watchdog timer
 
 
Line 55... Line 58...
    P1IE   = 0x00;                     // Port interrupt Edge Select (0=pos 1=neg)
    P1IE   = 0x00;                     // Port interrupt Edge Select (0=pos 1=neg)
    P2IE   = 0x00;
    P2IE   = 0x00;
 
 
    WDTCTL = WDTPW | WDTTMSEL | WDTCNTCL;// | WDTIS1  | WDTIS0 ;          // Configure watchdog interrupt
    WDTCTL = WDTPW | WDTTMSEL | WDTCNTCL;// | WDTIS1  | WDTIS0 ;          // Configure watchdog interrupt
 
 
    IE1 |= 0x01;
    IE1_set_wdtie();
    eint();                            //enable interrupts
    eint();                            //enable interrupts
 
 
 
 
    while (1) {                         // Main loop, never ends...
    while (1) {                         // Main loop, never ends...
 
 
        for (i=0; i<8; i++, o++) {
        for (i=0; i<8; i++, o++) {
            P3OUT = (1<<i) | (0x80>>(o&7));
            P3OUT = (1<<i) | (0x80>>(o&7));
            delay(0x0007, 0xffff);
            delay(0x0007, 0xffff);
        }
        }
    }
    }
}
 
 
 
 
    return 0;
 
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.