📄 main.c
字号:
/****************************************************************
*
* Copyright (C) 2006-2007 Texas Instruments, Inc.
*
*----------------------------------------------------------------
* All software and related documentation is provided "AS IS" and
* without warranty or support of any kind and Texas Instruments
* expressly disclaims all other warranties, express or implied,
* including, but not limited to, the implied warranties of
* merchantability and fitness for a particular purpose. Under no
* circumstances shall Texas Instruments be liable for any
* incidental, special or consequential damages that result from
* the use or inability to use the software or related
* documentation, even if Texas Instruments has been advised of
* the liability.
*
* Unless otherwise stated, software written and copyrighted by
* Texas Instruments is distributed as "freeware". You may use
* and modify this software without any charge or restriction.
* You may distribute to others, as long as the original author
* is acknowledged.
*
****************************************************************/
//--------------------------------------
//Program with hardware USART and
//paralel communication interface
//with TIR reader chip.
//
//PORT 2.0-2.7 - (IO0-IO7) for parallel interface with reader chip
//PORT3.4 - PORT3.5 - USB/UART control signals
//PORT1.5 - IRQ
//PORT3.7 - DATA_CLK
//PORT4.0 - PORT4.6 - signaling LEDs
//--------------------------------------
#define DBG 0
#include <MSP430x15x.h> //can't be greater than 256+13
#include <stdlib.h> //Processor specific definitions
#include <stdio.h>
#include "hardware.h"
#include "spi.h"
#include "anticollision.h"
#include "globals.h"
#include "tiris.h"
#include "14443.h"
#include "host.h"
#include "epc.h"
#include "automatic.h"
// =======================================================================
char rxdata; //RS232 RX data byte
unsigned char buf[BUF_LENGTH];
signed char RXTXstate; //used for transmit recieve byte count
unsigned char flags; //stores the mask value (used in anticollision)
unsigned char RXErrorFlag;
unsigned char RXflag; //indicates that data is in buffer
unsigned char i_reg; //interrupt register
unsigned char counter;
unsigned char CollPoss;
// =========================================================================
// Main function with init and an endless loop
//
//
void main(void) {
// initialize peripherals
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
EnableSet;
TRFDisable;
delay_ms(1);
TRFEnable;
PARset(); //Set Port Functions
InitialSettings(); // Set MCU Clock Frequency to 13.56/2=6.78 MHz and OOK Modulation
OSCsel(0x00); //set the oscilator
delay_ms(10);
LEDpowerON;
USARTset(); //Set the UART for 115.2 kbps data rate
EnableInterrupts; // General enable interrupts
OOKdirIN; //set OOK port tristate
ENABLE = 1;
POLLING = 1;
FindTags(0x00);
}
// === end of main =====================================================
// === Modifications====================================================
// 10/30/06 Aarthi Moved the while(1) loop from function main() to
// file host.c
// =====================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -