Changed from using delay function to a counter so that if a string is received, it will be repeated/transmitted back more quickly
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "usci.h"
|
#include "usci.h"
|
||||||
|
|
||||||
|
long delayCounter = 0;
|
||||||
volatile unsigned char status_flag = FALSE;
|
volatile unsigned char status_flag = FALSE;
|
||||||
char USBTransmitString[] = "[DEBUG] Test Transmission String";
|
char USBTransmitString[] = "[DEBUG] Test Transmission String";
|
||||||
char* pUSBReceiveString;
|
char* pUSBReceiveString;
|
||||||
@@ -37,14 +38,17 @@ int main(void) {
|
|||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
// Repeating debug transmission string
|
// Repeating debug transmission string
|
||||||
usci_A2_transmitString(&USBTransmitString[0]);
|
if(delayCounter == 0){
|
||||||
|
usci_A2_transmitString(&USBTransmitString[0]);
|
||||||
|
}else{
|
||||||
|
++delayCounter;
|
||||||
|
delayCounter %= 10000;
|
||||||
|
}
|
||||||
|
|
||||||
// String received, to be transmitted back
|
// String received, to be transmitted back
|
||||||
if(pUSBReceiveString[0] != '\0'){
|
if(pUSBReceiveString[0] != '\0'){
|
||||||
usci_A2_transmitString(pUSBReceiveString);
|
usci_A2_transmitString(pUSBReceiveString);
|
||||||
pUSBReceiveString[0] = '\0';
|
pUSBReceiveString[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
delayMultiplied(5000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user