display greater than 8 bit numbers
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.
Re: display greater than 8 bit numbers
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"
Re: display greater than 8 bit numbers
may be.......
SEROUT2 is not supported on 12-bit core PIC MCUs due to RAM and stack constraints.
pbp3 man
Re: display greater than 8 bit numbers
Re: display greater than 8 bit numbers
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.