Simple PC Menu System with Serin2


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125

    Question Simple PC Menu System with Serin2

    I have a serial configuration screen I want to build where a person can enter a # and have that number be acted upon by my program. The problem is I can't figure out how to get the PIC to know what number I am pushing..

    Here is the routine:

    settings:
    LCDout $fe, 1
    LCDout $fe, 2
    LCDout $fe, L1, "You must use PC to"
    LCDout $fe, L2, "view menu and make"
    LCDout $fe, L3, "changes there."
    LCDout $fe, L4, "Use 9600b to connect"
    serout2 AGPSout, PC96,[27,91,50,74] ' clear screen vt-100
    while Set_Item <> 9
    serout2 AGPSout, PC96,[27,91,50,59,51,72] ' 50 = 2 th row, 3rd column
    serout2 AGPSout, PC96,["Enter 'A' and a value to change passthrough mode."]
    serout2 AGPSout, PC96,[27,91,52,59,51,72] ' 52=4 th row, 3rd column
    serout2 AGPSout, PC96,[" A - 1 = Passthru turned on"]
    serout2 AGPSout, PC96,[27,91,53,59,51,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,[" A - 2 = Passthru turned off"]
    serout2 AGPSout, PC96,[27,91,54,59,51,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,[" A - 7 = Nothing"]
    serout2 AGPSout, PC96,[27,91,55,59,51,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,[" A - 9 = Exit System"]
    Serin2 AGPSin, PC96,[HEX Set_item]
    Set_item = Set_item - $30
    If Set_item = 1 then
    LCDout $fe, 1
    LCDout $fe, 2
    LCDout $fe, L1, "selected 1"
    serout2 AGPSout, PC96,[27,91,57,59,57,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,["TracID Passthrough is ON"]
    passthru = 1
    PAUSE 1000
    endif
    if Set_item = 2 then
    LCDout $fe, 1
    LCDout $fe, 2
    LCDout $fe, L1, "selected 2"
    serout2 AGPSout, PC96,[27,91,57,59,57,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,["TracID Passthrough is OFF"]
    passthru = 0
    PAUSE 1000
    endif

    if Set_item = 9 then
    LCDout $fe, 1
    LCDout $fe, 2
    LCDout $fe, L1, "Exiting Setup"
    serout2 AGPSout, PC96,[27,91,50,74] ' clear screen vt-100
    serout2 AGPSout, PC96,[27,91,49,59,57,72] ' 5 th row, 3rd column
    serout2 AGPSout, PC96,["Exiting Setup"]
    pause 1000
    bmenu =1
    endif
    wend

    Set_item = 0
    return


    It USED to work when I had the routine wait for an "A" before it accepted a number value, but now that I removed the WAIT ("A"), var, and am going direclty for looking at what the user types, it is not matching anything. And I don't want to have to type an "A" before the number I want - I just want them to enter a number...

    If FIGURED that if I captured HEX value of the key, and subtracted $30 from it, I'd get a number.. it doesn't seem to work that way

    Anyone have a better way to do this?

    Tom

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Read carefully the PBP manual under the SERIN2 statement. You'll discover DEC modifier. That will do the job for you. Play with DEC2
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Thumbs up

    PERFECT!! DEC1 is what I was looking for. Thanks. Amazing how it can be right there on the page.. and not be seen..

    Tom

Similar Threads

  1. Getting SERIN2 to work?
    By BobPigford in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 22nd July 2009, 20:10
  2. Sending menu to PC from PIC16F876A
    By joseph Degorio in forum Serial
    Replies: 2
    Last Post: - 12th November 2007, 07:03
  3. PIC16F877A - Timer0 won't interrupt
    By WishMaster^ in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 25th April 2007, 08:25
  4. Replies: 4
    Last Post: - 7th September 2005, 14:11
  5. Interrupt Menu System Example and Help Needed
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 1st April 2005, 17:05

Members who have read this thread : 0

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