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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [xilinx_diligent_s3board/] [software/] [ta_uart/] [main.c] - Diff between revs 143 and 153

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 143 Rev 153
Line 7... Line 7...
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include "swuart.h"
#include "swuart.h"
//#include "fll.h"
//#include "fll.h"
 
 
 
volatile int rxdata;
 
 
/**
/**
Delay function.
Delay function.
*/
*/
void delay(unsigned int d) {
void delay(unsigned int d) {
   while(d--) {
   while(d--) {
Line 43... Line 45...
    P2IES  = P2IES_INIT;                //init port interrupts
    P2IES  = P2IES_INIT;                //init port interrupts
    P2IE   = P2IE_INIT;
    P2IE   = P2IE_INIT;
 
 
    P3DIR  = 0xff;
    P3DIR  = 0xff;
    P3OUT  = 0xff;                      //light LED during init
    P3OUT  = 0xff;                      //light LED during init
    delay(65535);                       //Wait for watch crystal startup
//    delay(65535);                       //Wait for watch crystal startup
    delay(65535);
    delay(10);
//  fllInit();                          //Init FLL to desired frequency using the 32k768 cystal as reference.
//  fllInit();                          //Init FLL to desired frequency using the 32k768 cystal as reference.
    P3OUT  = 0x00;                      //switch off LED
    P3OUT  = 0x00;                      //switch off LED
 
 
    TACTL  = TACTL_AFTER_FLL;           //setup timer (still stopped)
    TACTL  = TACTL_AFTER_FLL;           //setup timer (still stopped)
    CCTL0  = CCIE|CAP|CM_2|CCIS_1|SCS;  //select P2.2 with UART signal
    CCTL0  = CCIE|CAP|CM_2|CCIS_1|SCS;  //select P2.2 with UART signal
Line 85... Line 87...
                    break;
                    break;
                //backspace
                //backspace
                case '\b':
                case '\b':
                    if (pos > 0) {      //is there a char to delete?
                    if (pos > 0) {      //is there a char to delete?
                        pos--;          //remove it in buffer
                        pos--;          //remove it in buffer
                        putchar('\b');  //go back
                        putchar((int)'\b');  //go back
                        putchar(' ');   //erase on screen
                        putchar((int)' ');   //erase on screen
                        putchar('\b');  //go back
                        putchar((int)'\b');  //go back
                    }
                    }
                    break;
                    break;
                //other characters
                //other characters
                default:
                default:
                    //only store characters if buffer has space
                    //only store characters if buffer has space
                    if (pos < sizeof(buf)) {
                    if (pos < sizeof(buf)) {
                        putchar(rxdata);     //echo
                        putchar(rxdata);     //echo
                        buf[pos++] = rxdata; //store
                        buf[pos++] = (char)rxdata; //store
                    }
                    }
            }
            }
        }
        }
    }
    }
}
}
 
 
 
interrupt (TIMERA0_VECTOR) INT_ccr0(void) {
 
 
 
  int rx_done;
 
  rx_done = ccr0();
 
 
 
  if (rx_done!=-1) {
 
    LPM0_EXIT;
 
    rxdata = rx_done;
 
  }
 
}
 
 
 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.