PDA

View Full Version : display greater than 8 bit numbers



AvionicsMaster1
- 7th May 2013, 15:50
I'm sure I'm going to say duh to this but here goes.

Question first, how do I display a number greater than 255 in a virtual terminal. I'm using a 12F683, PBP3 in a Proteus simulator. I want to do something like this:

x var word
y var word
z var word
x=20
y=20
z = y * x
serout2 dec z ' I know some stuff is missing. Just giving you an idea of what I'm doing.

Using this scenario z equals 400. When I send it out to the terminal I get 144 displayed because the largest z can be is 255. The binary of 400 is 1 1001 0000 but I only get the last 8 bits sent out, 1001 0000, to the display which is 144.

Please don't smack me down too hard. Thanks for your time.

Dave
- 7th May 2013, 17:12
What makes you think that "Z" can only count to 255? "Z" is set to be a word of 16 bits so it can count to 65535 maximum. As far as sending it out to the serial port, are you trying to send it in ASCII or the binary representation? You should be seeing on your terminal "400"

amgen
- 7th May 2013, 17:50
may be.......

SEROUT2 is not supported on 12-bit core PIC MCUs due to RAM and stack constraints.

pbp3 man

mackrackit
- 7th May 2013, 20:14
12F683 is 14 bit.

AvionicsMaster1
- 11th May 2013, 00:41
Ding ding ding ding ding! I knew I'd say Duh! when this was over. I was certain I had declared that variable as a word. I looked at it dozens of times to make sure. In the end I had set it up as a byte. Thanks for your replies and I wish they'd add a pull your head out button on PBP4.

All is well.