Shop OBEX P1 Docs P2 Docs Learn Events
Begining BS2 Programming - Input Data - Double Digit Numbers — Parallax Forums

Begining BS2 Programming - Input Data - Double Digit Numbers

ArchiverArchiver Posts: 46,084
edited 2002-11-12 18:53 in General Discussion
Hi All:

Sid had answered my question about how to input keyboard data and
store it in a BS2(See below). I have a new problem on the program
accepting 2 digit numbers.

When I try to input a 2 digit number and store...say 10 or 20, it
only stores the 1 digit for the value COM. It then truncates the last
digit...Any body got any ideas how I can store any number entered
from the keyboard ? Thanks..JB


>
> Write
> N9600 con 16468
> com bar byte
>
> serout 16, N9600, [noparse][[/noparse]"Enter number of waypoints", cr]
>
> Message will appear on debug screen
>
> serin 16, N9600, [noparse][[/noparse]com]
>
> From the keyboard, enter a number. It will be stored in the
variable "com".
> Sid Weaver
> W4EKQ
> Port Richey, FL
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-11-12 18:53
    Your problem is probably that you are receiving ASCII data from the keyboard
    and need to convert it to decimal before you can store it in a byte
    variable. You could probably solve this by making COM a 2 byte array.

    Robert


    > Hi All:
    >
    > Sid had answered my question about how to input keyboard data and
    > store it in a BS2(See below). I have a new problem on the program
    > accepting 2 digit numbers.
    >
    > When I try to input a 2 digit number and store...say 10 or 20, it
    > only stores the 1 digit for the value COM. It then truncates the last
    > digit...Any body got any ideas how I can store any number entered
    > from the keyboard ? Thanks..JB
    >
    >
    > >
    > > Write
    > > N9600 con 16468
    > > com bar byte
    > >
    > > serout 16, N9600, [noparse][[/noparse]"Enter number of waypoints", cr]
    > >
    > > Message will appear on debug screen
    > >
    > > serin 16, N9600, [noparse][[/noparse]com]
    > >
    > > From the keyboard, enter a number. It will be stored in the
    > variable "com".
    > > Sid Weaver
    > > W4EKQ
    > > Port Richey, FL
    > >
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.