??? 06/13/05 11:22 Read: times |
#94765 - Here's my code Responding to: ???'s previous message |
The following code sets the TI flag, but I cant see anything in the hyperterminal window....Now, if the TI flag is being set, definitely something must be transmitted....Them why dont I see anything in Hyperterminal...? The baud rate calculation is correct....I'm sure....I'm using a baud rate of 4800....so TH1 is initialised to f7....Plz go thro' this code and let me know where I'm going wrong....
Also, sbuf is always 00...It never becomes 50,the value I want to move to sbuf...Why is this happening? I've tried using watchpoints, which will halt theprogram the moment sbuf becomes something other than 00....but sbuf always remains 0.....But then why is the TI flag being set...? PLZ SOMEBODY HELP ME>>>>I'm going crazy figuring this out.... Even if u cant help me with any specifics, atleast post a reply to this thread so that I'm sure atleast somebody has read my problem..... Here's my code:(I'm using the Silicon labs microcontroller kit C8051 F226) ;----------------------------------------------- $INCLUDE(C8051F200.INC) ; Register definition file. org 0000h mov PRT0MX, #01h ; this routes TX and RX to p0.0 and p0.1 resp ; Oscillator Configuration ;--------------------------------------------------------------- mov OSCXCN, #030h ; External Oscillator Control Register mov OSCICN, #007h ; Internal Oscillator Control Register ;-------------------------------------------------------------- mov tmod,#20h ; timer1, mode2, auto reload mov th1,#0f7h ; 4800 baud rate ;int osc freq=16 Mhz....16 Mhz/(12*32*4800)=8.68... ;hence th1=-9=0f7h mov scon,#50h ; 8 bit, 1 stop, REN enabled setb tr1 ; start timer 1 mov a,#34h setb ti loop:clr ti mov sbuf,#54h here:jnb ti,here ; wait for TI flag to be set by hardware sjmp loop ; keep transmitting END |
Topic | Author | Date |
uart initialisation problem | 01/01/70 00:00 | |
Here's my code![]() | 01/01/70 00:00 |