Reply
Posts: 24
Registered: ‎06-23-2015
Accepted Solution

Hyper simple problem

OK, I'm extraordinarily embarassed to have to post this, but I'm running into a problem which should be so incredibly simple, that the solution will probably be instantly obvious to someone other than me. I've been using this CPU for years, lots of asynch communications with interrupts, so it's not like I haven't had experience... but this has got me stumped. For some bizarre reason, I cannot spit out any characters out of UART0. I can receive characters, and the RI0 interrupt bit works great... but I'm just not able to send any output... TI0 never goes high. I have a fairly elaborate interrupt based receive routine which is working perfectly... but when I got to the point of implementing the output part of the program (something I've done countless times), I find that I can't spit a character out... doesn't matter if I'm trying to do it with simple polling of TI0, or if I'm trying to respond to a TI0 interrupt.

 

It got to the point where I constructed the SIMPLEST possible example program, to simply generate a single character output at 57.6 kbaud (running on the Silabs C8051F12x eval board):

 

$nolist

$include (C8051F120.inc)

$list

;

CSEG AT 0

ORG 0H

MOV SP,#0D0H

mov SFRPAGE, #TIMER01_PAGE

mov TCON, #050h

mov CKCON, #010h

mov TH1, #0F3h

mov TMOD, #020h

;

mov SFRPAGE, #UART0_PAGE

mov SCON0, #050h

;

mov SFRPAGE, #CONFIG_PAGE

mov XBR0, #004h

mov XBR2, #040h

;

MOV SBUF0,#'a'

jnb TI0,$

CLR ti0

JMP $

end

 

When I get to the line where I'm polling for TI0 to go high, it stalls there, and there's no UART output. If I single-step past the 'mov sbuf0,#'a' line, and look at SBUF using the IDE, it's content does not change... it doesn't show the 'a' character as having been loaded. I'm sure this must be something so grossly obvious, as to be silly... but I just don't see it. I don't have a spare board, so there's the possibility that my board is damaged... but I would find that VERY hard to believe.... Anyone have any ideas? Anyone see what stupid thing I'm doing, or not doing?

Posts: 8,078
Registered: ‎08-13-2003

Re: Hyper simple problem

sfrpage ??

erik
Posts: 24
Registered: ‎06-23-2015

Re: Hyper simple problem

Arrrggghh.... please allow me to swallow my pride and thank you for pointing out just what a dumb error it was... this doesn't happen to me often, but when it does, boy, do I feel like an idiot!

 

Many thanks... and I'll close the thread now.

Posts: 8,078
Registered: ‎08-13-2003

Re: Hyper simple problem

Arrrggghh.... please allow me to swallow my pride and thank you for pointing out just what a dumb error it was... this doesn't happen to me often, but when it does, boy, do I feel like an idiot!

 

happens to all of us that we can not see the tree for the forrest

erik
Highlighted
Posts: 3,021
Registered: ‎02-07-2002

Re: Hyper simple problem

One other thing. You cannot read SBUF to see if it contains what you wrote into it. It is actually two registers: one write-only and one read-only.