Hi, I'm trying to simulate working of a UART. When I write into SBUF, the TI flag doesn't go high even though I have enabled interrupts. Is there any way I can simulate it using SOUT VTREG. can't find example how to use SOUT.
"If I am to write to SBUF in the isr then I am facing an issue of reentrancy." How do you figure that? "My main interest is to say, write "Hello World" and I would like to use some_func(char *str) in the main(void) so I would give something like some_func("Hello World") in the main and our serial ISR is exected to print it and then wait for the next string whenever I send through some_func. How should do that?" How about this: printf("Hello world"); If you compiled Keil's serial interrupt code that is all you would have to do. Why are you determined to reinvent the wheel?
Stefan, I'm hoping that Rohit just wants to use this as a learning exercise since he's obviously new to the 8051. If that's the case, it's probably not a bad idea for him to hack around with code like this. Just my two cents.
Thanks Stefan and Daniel. I am able to understand with the examples provided by you.
"I'm hoping that Rohit just wants to use this as a learning exercise since he's obviously new to the 8051. If that's the case, it's probably not a bad idea for him to hack around with code like this. Just my two cents." Point taken, and I agree. However, if he were to thoroughly analyse Keil's code all his questions would be answered.
Stefan, That's probably true. Unless he's nearly as feeble-minded as me and can't see the forest for the trees when looking at larger code samples. :)