RFID Issues with MSP430 using the UART interface
Hi everyone,
Recently I bought the RFID reader from here but I have been unable to make it work the way i would like to. I'm using UART to connect with the RFID and it looks like I'm able to read information from the tags by using the code below (I get a mix of what I would expect with some random stuff), but I'm not sure on how to receive the whole string of a tag. Any ideas?? Thanks in advance!
Recently I bought the RFID reader from here but I have been unable to make it work the way i would like to. I'm using UART to connect with the RFID and it looks like I'm able to read information from the tags by using the code below (I get a mix of what I would expect with some random stuff), but I'm not sure on how to receive the whole string of a tag. Any ideas?? Thanks in advance!
#include "msp430x54x.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; P10SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD UCA3CTL1 |= UCSWRST; // **Put state machine in reset** UCA3CTL1 |= UCSSEL_1; // CLK = ACLK UCA3BR0 = 0x0D; // 2400 (see User's Guide) UCA3BR1 = 0x00; // UCA3MCTL |= UCBRS_6+UCBRF_0; // Modulation UCBRSx=6, UCBRFx=0 UCA3CTL1 &= ~UCSWRST; // lize USCI state machine** UCA3IE |= UCRXIE; // Enable USCI_A1 RX interrupt __bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled __no_operation(); // For debugger } // Echo back RXed character, confirm TX buffer is ready first #pragma vector=USCI_A3_VECTOR __interrupt void USCI_A3_ISR(void) { int i; char test[noparse][[/noparse]12]; switch(__even_in_range(UCA3IV,4)) { case 0:break; // Vector 0 - no interrupt case 2: // Vector 2 - RXIFG // USCI_A1 TX buffer ready? while (!(UCA3IFG&UCTXIFG)); for(i=0; i<13; i++) test[i] = UCA3RXBUF; //UCA3TXBUF = UCA3RXBUF; // TX -> RXed character break; case 4:break; // Vector 4 - TXIFG default: break; } } [/i]
Comments
Make sure your MSP430 UART timing is correct. A timing mismatch will certainly cause random character errors.
Any help would really be appreciate it.