Ok, I'm still having problems. I'm using the UART library as provided by Admin in his UART tutorial. I thought I had solved the receive problem when I added the buffer initialization function, but that quieted the UART completely as the mcu didn't send any notification data to send the data. Basically the code is as follows, I send a single byte through HyperTerminal and the mcu outputs the data as a 4 Bit number(Only allowing the numbers 0-9) which is sent to a 7-Segmented decoder to display on an LED display:
//UART_Test 2011 Nick Winston
//Tests Tx and Rx with the built-in UART, outputs
//sent data on two-digit Numeric LED display.
//Headers
#include "global.h"
#include "stdint.h"
#include "io.h"
#include "iom88.h"
#include "uart.h"
#include "delay.h"
#include "interrupt.h"
#include "power.h"
#include "buffer.h"
#include "rprintf.h"
//Pin Definitions
#define RunButton PB0
//Main Task
int main(void) {
//IO Setup
DDRD = 0xFF;
DDRC = 0xFF;
DDRB = 0x00;
//Variable Setup
int UARTByteIn; //For accepting ASCII Input
//Disable unneccessary modules
power_adc_disable();
power_twi_disable();
//Program Start Button
while((PINB & _BV(RunButton)) != 0) {
PORTD=0b00100000; //Red
_delay_ms(250);
PORTD=0b01000000; //Green
_delay_ms(250);
}
PORTD=0b01000000;
uartInit(); // initialize UART
uartSetBaudRate(9600); // set UART baud rate
uartInitBuffers(); //Enable Buffers to read bytes from the Rx Buffer
rprintfInit(uartSendByte);
rprintf("Input data now, hit the A Key to shut down.\n");
while(UARTByteIn != 65) {
if(uartReceiveBufferIsEmpty() != TRUE) {
UARTByteIn=uartGetByte();
switch(UARTByteIn) {
case 48:
PORTC=0b00000000;
case 49:
PORTC=0b00000001;
case 50:
PORTC=0b00000010;
case 51:
PORTC=0b00000011;
case 52:
PORTC=0b00000100;
case 53:
PORTC=0b00000101;
case 54:
PORTC=0b00000110;
case 55:
PORTC=0b00000111;
case 56:
PORTC=0b00001000;
case 57:
PORTC=0b00001001;
}
uartFlushReceiveBuffer();
}
}
rprintf("End of Line");
PORTD=0b00000000;
}
Thank you