PDA

View Full Version : HSEROUT No Output Problem



CocaColaKid
- 22nd August 2005, 15:22
I have a problem that I can not seem to figure out. If I use the line of code:

hserout [sign,dec3 temp/10,".",dec1 temp//10,10]

I get nothing display in my serial window however it says that it is receiving bytes. If I remove the "sign" from the line it works fine. Can someone shed some light on this one for me because it is driving me nuts.

Bruce
- 22nd August 2005, 15:45
Have you tried using the DEC modifier before sign?

CocaColaKid
- 22nd August 2005, 15:52
I load the variable with:



if temp.8 = 1 then ' If bit8 of temperature is set then its negative
sign = 45 ' Indicate temperature is NEGATIVE
temp.lowbyte = temp.lowbyte ^ 255 ' Reverse the bits of the lowbyte of TEMP
sign = 160 ' Indicate temperature is POSITIVE
endif


If I use DEC then my output is messed up. I did try it though and it does output.

Bruce
- 22nd August 2005, 15:59
Try this;


if temp.8 = 1 then ' If bit8 of temperature is set then its negative
sign = "-" ' Indicate temperature is NEGATIVE
temp.lowbyte = temp.lowbyte ^ 255 ' Reverse the bits of the lowbyte of TEMP
sign = "+" ' Indicate temperature is POSITIVE
endif

CocaColaKid
- 22nd August 2005, 16:07
Same thing, I tried this approach as well.

CocaColaKid
- 22nd August 2005, 16:13
I don't understand what it actually is that I'm sending since there is nothing displayed in the serial window. It just keeps increasing by 6 bytes at a time.

Bruce
- 22nd August 2005, 16:17
How do you know it's increasing if there's nothing showing in the serial window?

CocaColaKid
- 22nd August 2005, 16:30
I'm using the Serial Communicator in MCSP which display TX and RX in the bottom status bar.

arniepj
- 22nd August 2005, 17:00
If you haven't already,double check each variable by re-sending each one individually,with and without LF,in combinations,to see if the answer falls out.The other possibility is the receiving program may have limits that are removing characters,like buffer size.
I use a program call Simple Terminal from BB Electronics.It runs in dos window,but displays everything.

CocaColaKid
- 22nd August 2005, 17:15
I feel pretty dumb right now. If you look at the code there is no else if the if statement.

Acetronics2
- 22nd August 2005, 17:19
if temp.8 = 1 then ' If bit8 of temperature is set then its negative
sign = "-" ' Indicate temperature is NEGATIVE
temp.lowbyte = temp.lowbyte ^ 255 ' Reverse the bits of the lowbyte of TEMP
sign = "+" ' Indicate temperature is POSITIVE
endif

> So, no sign if positive , or + sign if negative ??? ... doesn't really mean the same.

> And I'm wondering if "sign" value is defined somewhere else ...if positive !

Alain