Hey,
here is the definition for the serial port block i am using with regards to the SBUF...
Code:
Serial Data Buffer Register (SBUF)
The serial data interface consists of two separate registers, a transmit register and a receive register (with buffer), both of which are accessed through the Special Function Register SBUF. Writing to the SBUF register loads data into the serial transmit register and starts the transmission. Reading the SBUF register, accesses data in the serial receive buffer.
The SRL0 is full duplex, meaning that it is capable of simultaneous transmission and reception of serial data. Single-byte buffering is incorporated at the reception stage, enabling a second byte of data to be received whilst the first is still being read. Bear in mind that the first byte of received data must be read out before reception of the subsequent byte has completed, otherwise the first byte of data will be lost (overwritten with the second byte).
I feel like i'm really close too, but every time I change something it doesn't work, I make a new approach and just feels like i'm going round and round in circles.
this is actually the first time with using readChar or readString! it is the same as what ive got in there for writing char and string? i cant seem to find too much info on this stuff
Code:
//READS IN CHARACTERS FROM HYPERTERMINAL---------------------------------------
void ReadChar(char Input){
unsigned char variable = 0;
Input = SLR0_SBUF;
while (variable != 0x01) {
variable = SLR0_SCON & 0x01;
delay();
}
SLR0_SCON = 0x40;
}
void ReadString(char *Str){
//unsigned char p;
char message[10];
char let;
int index = 0;
while((let = getchar())!='\n'){
message[index]=let;
for(index=0; Str[index]!='\0'; index++)
ReadChar(Str[index]);
}
}
I cannot get it hey, are you able to hint me any closer or give me more clues... this is only the start of my coding. I just need to get over this hurdle!
I really appreciate ur time
Thanks