Hi.
That kind of fixed the problem, but it's not functionel.
This is the code:
char i, error, byte_read; // Auxiliary variables
void main(){
OSCCON = 0b01110101; // 16F684
ANSEL = 0x00;
CMCON0 = 0x07;
TRISA = 0b00001000;
TRISC = 0;
PORTC.b2 = 0; // Enable the RFID Reader
error = Soft_UART_Init(&PORTC, 0, 1, 2400, 0); // Initialize Soft UART at 2400 bps
if (error > 0) {
PORTA.b0 = 1; // Signalize Init error
while(1) ; // Stop program
}
Delay_ms(100);
for (i = 'z'; i >= 'A'; i--) { // Send bytes from 'z' downto 'A'
Soft_UART_Write(i);
Delay_ms(100);
}
while(1) { // Endless loop
byte_read = Soft_UART_Read(&error); // Read byte, then test error flag
if (error == 1) // If error was detected
PORTA.b0 = 1; // Signalize Init error
else if (error == 255)
PORTA.b1 = 1;
else
Soft_UART_Write(byte_read); // If error was not detected, return byte read
}
}
The project settings is set to internal clock and 8MHz. In the computer I recieve the characters from z to A fine, and if I write a single character, I get it back correctly.
But if I write more than 1 character, I get some strange feedbacks, but there is some kind of pattern in what I recieve. I only recieve every second letter - fx:
Quote:
Write: Thomas Jespersen
Recieve: Toa epre
Write: abcdef
Recieve: ace
Write: 123456
Recieve: 135
Why is this happening? In my project I have to store the characters I recieve in a buffer and then check for an RFID code in that buffer when 0x0D is recieved.
But I can't, as I can't recieve the RFID serial data stream correctly?
Best Regards
Thomas Jespersen