We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using microvision2 (UV2)environment. when i use the following code from examples(given by keil) i see "hello world" in the serial window, when i use degugger. #include <REG52.H> #include <stdio.h> #ifdef MONITOR51 char code reserve [3] _at_ 0x23; #endif void main (void) { #ifndef MONITOR51 SCON = 0x50; TMOD = 0x20; TH1 = 221; TR1 = 1; TI = 1; #endif while (1) { printf ("Hello World\n"); } } But when i run my code written in assembly(shown below) does not give any output on serial window. org 00 mov scon,#52h mov tmod,#20h mov th1,#221 setb tr1 setb t1 loop: mov A,#1 mov SBuf,A jmp loop end Pl point me my mistake. suggest remedial measures.
You need to wait for TI to go true before loading SBUF. You would also probably be better to use a printable character rather than 1. In 'C': while(1) { while(!TI); TI=0; SBUF='A'; } Stefan
thanks stefen, it solved my problem