"Debug_UART-USB" project finished, now needs to be debugged
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include "interrupts.h"
|
#include "interrupts.h"
|
||||||
|
|
||||||
extern volatile unsigned char status_flag;
|
extern volatile unsigned char status_flag;
|
||||||
|
extern char* pUARTReceiveString;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timer B CCR0 Interrupt Service Routine
|
* Timer B CCR0 Interrupt Service Routine
|
||||||
@@ -27,3 +28,8 @@ __interrupt void TIMER0_B0_ISR(void){
|
|||||||
P8OUT &= ~LEDG; // Turn off the green LED
|
P8OUT &= ~LEDG; // Turn off the green LED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma vector = USCI_A2_VECTOR
|
||||||
|
__interrupt void USCI_A2_ISR(void){
|
||||||
|
usci_A2_receiveString(pUARTReceiveString);
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "usci.h"
|
#include "usci.h"
|
||||||
|
|
||||||
volatile unsigned char status_flag = FALSE;
|
volatile unsigned char status_flag = FALSE;
|
||||||
|
char UARTTransmitString[] = "[DEBUG] Test Transmission String";
|
||||||
|
char* pUARTReceiveString;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer; `WDTPW` is the "WatchDog Timer PassWord", required for all `WDTCTL` operations
|
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer; `WDTPW` is the "WatchDog Timer PassWord", required for all `WDTCTL` operations
|
||||||
@@ -27,15 +29,22 @@ int main(void) {
|
|||||||
|
|
||||||
P8OUT |= LEDY0; // Initially set LEDY0 to High
|
P8OUT |= LEDY0; // Initially set LEDY0 to High
|
||||||
|
|
||||||
|
pUARTReceiveString = calloc(1, 256 * sizeof(*pUARTReceiveString) + 1);
|
||||||
|
|
||||||
usci_A2_enable();
|
usci_A2_enable();
|
||||||
usci_A2_enableInterrupt();
|
usci_A2_enableInterrupt();
|
||||||
|
|
||||||
char UARTTransmitString[] = "[DEBUG] Test Transmission String";
|
|
||||||
char* pUARTReceiveString = calloc(1, 256 * sizeof(*pUARTReceiveString) + 1);
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
// Repeating debug transmission string
|
||||||
usci_A2_transmitString(&UARTTransmitString[0]);
|
usci_A2_transmitString(&UARTTransmitString[0]);
|
||||||
|
|
||||||
|
// String received, to be transmitted back
|
||||||
|
if(pUARTReceiveString[0] != '\0'){
|
||||||
|
usci_A2_transmitString(pUARTReceiveString);
|
||||||
|
pUARTReceiveString[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
delayMultiplied(5000);
|
delayMultiplied(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user