Key_in from terminal


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326

    Default Key_in from terminal

    Good day to all in the forum,

    I wrote a simple program using Picbasic Pro that increases or decreases a variable in the program using the "U" or the "D" keys from a PC terminal program like the windows Hyperterminal.
    It works but I will like to enter the numeric value to be assigned to the TON variable in my program using the terminal keyboard and tyiping the required value as like as 2568 msec.
    This is my presently used code:

    DEBUG " ENTER U or D then F to finish "
    PIPPO:
    DEBUGIN [KEY_IN]
    if key_in="U" then ton=ton+100
    if ton>10000 then ton=10000
    DEBUG 13,10,DEC TON, 13,10
    IF KEY_IN="D" THEN TON=TON-100
    IF TON<1 THEN TON=1
    DEBUG 13,10,DEC TON ,13,10
    TOFF=10000-TON
    IF KEY_IN="F" THEN GOTO MAIN
    GOTO PIPPO
    GOTO MAIN

    Any help in writing the picbasic code ?
    Thanks a lot for any help on the matter.
    regards,
    Ambrogio
    IW2FVO
    North Italy

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    ton = key_in
    ??
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    No Dave it won't work because debugin reads one byte.

    DEC modifier must be used here.

    Ioannis

  4. #4
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Ioannis,
    any code suggestion to enter values from 0 to about 65535 DEC ?
    Thanks for the assistance,
    Ambrogio

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    See the Debugin 2nd example in the manual.

    DEBUGIN [dec key_in]

    Ioannis

  6. #6
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Thanks,

    I was able to write the code.
    Here it is:


    A VAR PORTB.3
    B VAR PORTB.4

    TON VAR WORD
    TOFF VAR WORD
    I VAR WORD
    KEY_IN VAR WORD
    TON=50 'DEFAULT
    TOFF=50 'DEFAULT

    LOW A
    LOW B


    MAIN:
    FOR i =0 TO 3000
    HIGH A
    PAUSEUS TON
    LOW A
    PAUSEUS TOFF
    HIGH B
    PAUSEUS TON
    LOW B
    PAUSEUS TOFF
    NEXT I
    DEBUG " ENTER TON " ,13,10,7 ' TON ENTER > PROMPT DISPLAYED

    DEBUGIN [DEC KEY_IN]
    TON= KEY_IN
    DEBUG "TON=" ,DEC TON,13,10 ' DISPLAY TON ON TERMINAL
    DEBUG ">> GOING ON <<",13,10 ' DISPAY RUNNING ON TERMINAL

    GOTO MAIN

    Any additional suggestion is appreciated.
    Ambrogio
    IW2FVO
    North Italy

Similar Threads

  1. Very Useful Free Terminal Software for Windows
    By acjacques in forum Serial
    Replies: 12
    Last Post: - 30th January 2014, 13:44
  2. Hyper Terminal Setting for TTL putput
    By ClayE in forum Serial
    Replies: 6
    Last Post: - 7th June 2008, 06:50
  3. Tapping data from a Unix VT220 terminal
    By sougata in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd February 2006, 04:47
  4. what is hyper terminal?
    By moud_man in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th September 2005, 19:33
  5. USB Terminal
    By Normnet in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th April 2005, 11:51

Members who have read this thread : 1

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

Posting Permissions

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