Shop OBEX P1 Docs P2 Docs Learn Events
16 Bit Calculations — Parallax Forums

16 Bit Calculations

MARY_JONESMARY_JONES Posts: 3
edited 2006-11-24 04:14 in General Discussion
Anyone have any reference to some sample programs for a 16 bit calculator that run on SX.
I was able to run an 8 bit, having troble doing 16.
Any help is appriciated.

Thanks,
Mary

Post Edited By Moderator (Bean (Hitt Consulting)) : 11/21/2006 5:09:10 PM GMT

Comments

  • NateNate Posts: 154
    edited 2006-11-21 15:34
    Do a search on·sxlist.com



    Nate
  • BeanBean Posts: 8,129
    edited 2006-11-21 17:09
    Mary,
    What type of calculations do you want to perform ?

    P.S. I added a subject line to your post for you.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "People who are willing to trade their freedom for·security deserve neither and will lose both." Benjamin Franklin
    ·
  • MARY_JONESMARY_JONES Posts: 3
    edited 2006-11-22 01:32
    my final project will include addition, subtraction, multiplicatio, and division.
    Currently i am trying to figure out how to do addition and subtraction

    I am using 8 dip swith button as form of input and 8 LED's as outputs.
    ·
  • MARY_JONESMARY_JONES Posts: 3
    edited 2006-11-22 01:35
    n thanks for the subject line Bean

    mary
  • YendorYendor Posts: 288
    edited 2006-11-22 02:57
    Mary,

    Still confused...

    Can you detail your input?

    For example, you have a byte input now, apparently. Do you need to have a word input (2 bytes) and a word result (2 bytes)?

    First off, are we talking an infix calculator or RPN?
    If it's an infix calculator , then you need a middle step for the operator (e.g. 3 + 5 =)
    If it's RPN, then you put the operator at the end (3 ent 5 ent + )

    Then you need to devise the input. Are you fixed with only 8 switches for input? How are the operators handled? How is entry handled?

    If you need a word input you need to have a means of reading in the byte values twice per 'digit' (MSB/LSB) or have 16 switches.

    As far as output, If the result is a word you'll need to somehow come up with how to display 2 bytes on the LED's (e.g. display MSB, pause, display LSB, or use 16 LED's.)

    Rodney
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-11-22 17:42
    Well, SXLIST [noparse][[/noparse]www.sxlist.com] is definitely the right place to get started.

    I suspect that Mary wants to multiply 8 bits by 8 bits which gives 16 bit results. And Calculator may be a misnomer, she might want to demonstrate binary operation of math calculations.

    It does seem that she should consider having 16 leds though. That would require she use an SX-48 to have enough i/o. Of course she could keep the 8 leds and display a high and low byte sequentially and stay with an SX-28.

    With a DIP switch, this is certainly not going to be an infix or RPN calculator. That would require 10 numeric keys AND four function keys AND an equal key AND a clear [noparse][[/noparse]is that 16 keys?]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • TransistorToasterTransistorToaster Posts: 149
    edited 2006-11-24 04:14
    If you write a program in SX basic, you can use the built in multiplication, division, modulo, addition, etc with 2 byte resullts or operands. Just write the code and take a look at the compiler output and you will see how all these operations are handled with more than 8 bits.
    Frank
Sign In or Register to comment.