+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default 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.

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,196

    Default 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"
    Dave Purola,
    N8NTA
    EN82fn

  3. #3

    Default 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

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default Re: display greater than 8 bit numbers

    12F683 is 14 bit.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305

    Default 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.

Similar Threads

  1. Replies: 1
    Last Post: - 12th March 2012, 23:34
  2. Writing 16 bit numbers to timer 1
    By bison_bloke in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th March 2010, 11:01
  3. store/display very large numbers (700000)
    By ttease in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2007, 22:08
  4. 10 Bit A-D Numbers
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th April 2006, 22:44
  5. How to display large numbers
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th March 2006, 23:17

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts