interactive menu with hyperterminal


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Dec 2008
    Posts
    8

    Default interactive menu with hyperterminal

    I'm making a menu driven datalogger and am having trouble with hyperterminal not showing all my menu items. If there are only a few lines, everything displays with no problems. but if certain additional menu items show up then the last line of my menu only shows some characters or not at all.
    if the "MEMORY CONTAINS DATA" OR "TURBINE IS DE-ACTIVATED" gets displayed then the last line shows:

    HOLD (A) while LOGGING re

    instead of

    HOLD (A) while LOGGING returns to this menu

    I know with hyperterminal and realterm I have 20 lines by 80 characters so I can't figure out why my menu doesn't fully display.... I cant add any more menu items as they simply dissapear. I'm under the 500 character buffer limit so It's not that.

    I start be sending 27,91,50,74 ' this is the ansi esc[2J to clear the buffer
    This clears the buffer and screen, then I send 8 lines to hyperterminal for my menu items ( around 400 characters but below the 500 char buffer) each line is terminated with ,13,10
    if I try adding more menu items hyperterminal simply wont display them. The text only fills the first 1/4 of hyperterminals windows so lots of room for more.

    Thanks for any insight!!

    Jamie

    the serial speed is 38400N81 pic 16f877a and 20mhz xtal
    otherwise the transfer is rock solid.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    First of all, the information given by you is not sufficient to fully describe your problem.

    My impression is that your speed is unnecessarily high. Do you really need the 38400 baud speed? If not, drop it to 9600 and see if that helps improve things for you. Another thing you may try is to 'pace' the output from the PIC using the define meant for that.
    Code:
    define  CHAR_PACING  1000
    ' define the character pacing in microseconds

  3. #3
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Here's the menu code

    Yes I need 38400 because it dumps 131k of data when downloading logs.
    here is the menu code. the last line "HOLD (A) while LOGGING returns to this menu" wont display fully if I add any other menu items.
    As I sais the serial connection is rock solid with no problems whatsoever. I can download the data, interact with the menu all with no trouble, It just wont let me add any other menu items without partially or fully deleting the lower lines such as the "HOLD (A) while LOGGING returns to this menu"

    Thanks



    Serout2 SO,6,[" ITCV2.0 Turbine Controller (SW - V1.0) System Voltage is ",Dec SYSVolts," Volts", 10,13]
    Serout2 SO,6,[" < ",HEX2 RTCHr,":",HEX2 RTCMin,":",HEX2 RTCSec," ",HEX2 RTCMonth,"/",HEX2 RTCDate,"/",HEX2 RTCYear," Sample time = ",Dec SamTime," Sec >",10,10,13]
    If DirtyMem <> 255 Then
    Serout2 SO,6,[27,91,53,109," MEMORY Contains DATA!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    If TurStatus <> 255 Then
    Serout2 SO,6,[27,91,53,102," TURBINE IS DE-ACTIVATED!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    Serout2 SO,6,[ " (1) Turbine Setup Menu (2) Download Memory Banks",13,10]
    Serout2 SO,6,[ " (3) Erase Memory Banks (4) Set the sample time",13,10]
    Serout2 SO,6,[ " (5) Set the Clock (6) Log Data ("]
    If LogData = 1 Then
    Serout2 SO,6,[ "ON)",13,10]
    Else
    Serout2 SO,6,[ "OFF)",13,10,13,10]
    EndIf

    Serout2 SO,6,[ " (C) CLEAR THE SCREEN",10,13]
    Serout2 SO,6,[ "HOLD (A) while LOGGING returns to this menu",13,10]
    SerIn2 SI,6,[PCCommand]
    If PCCommand = 49 Then TurbineSetup
    If PCCommand = 51 Then ClrMem
    If PCCommand = 53 Then SetClock
    If PCCommand = 52 Then SampleTime
    If PCCommand = 67 Or PCCommand = 99 Then Menu
    If PCCommand = 54 Then
    If LogData = 0 Then LogData = 1:GoTo Menu
    If LogData = 1 Then LogData = 0:GoTo Menu
    EndIf
    If PCCommand = 50 Then
    Serout2 SO,6,[ 13,10]
    ADDR = 0
    Cont = Bank0A
    GoTo DumpMem
    EndIf

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    HyperTerminal allows you to set certain areas of the screen to scroll independently of the rest of the screen. And that mode is saved with the .ht file, so it stays there until reset. A 1-line scrolling area can cause things to not show up because it immediately scrolls out of the 1-line area after every [13,10].

    When playing around with ANSI codes, it's easy to trigger the mode without even realizing it.

    Try adding this to the top of the program, which should reset it if it's in that mode.
    Code:
    Serout2 SO,6,[27,"[r"]
    Creating a New Connection would also reset it, if it's the cause.

    hth,
    DT

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Did you try the character pacing define mentioned in my earlier post?

  6. #6
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Thanks for the replies

    I tried character pacing and it had no effect on the way the menu displays. just mad it slower. I also tried making a new hyperterminal window also with no change. the menu displays the same on realterm and teraterm so the 1 line scrolling in hyperterminal was also not the problem.

    Thank you for trying

    jamie

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I've run the routine you supplied, well ... had to add some stuff cause it was just a snippet, and my crystal was different.

    It ended up looking like this ...
    Code:
    DEFINE OSC 10
    
    SO  VAR PORTC.6
    SI  VAR PORTC.7
    
    Bank0A     CON 0 ; No idea
    
    RTCHr      VAR BYTE : RTCHr     = $17
    RTCMin     VAR BYTE : RTCMin    = $44
    RTCSec     VAR BYTE : RTCSec    = $28
    RTCMonth   VAR BYTE : RTCMonth  = 1
    RTCDate    VAR BYTE : RTCDate   = 3
    RTCYear    VAR BYTE : RTCYear   = 9
    SamTime    VAR BYTE : SamTime   = 12
    SYSVolts   VAR BYTE : SYSVolts  = 5
    DirtyMem   VAR BIT  : DirtyMem  = 1
    TurStatus  VAR BIT  : TurStatus = 1
    LogData    VAR BIT  : LogData   = 1
    
    PCCommand VAR BYTE  : PCCommand = 0
    ADDR      VAR BYTE  : ADDR      = 0
    Cont      VAR BYTE  : Cont      = 0
    
    Serout2 SO,32,[" ITCV2.0 Turbine Controller (SW - V1.0) System Voltage is ",Dec SYSVolts," Volts", 10,13] 
    Serout2 SO,32,[" < ",HEX2 RTCHr,":",HEX2 RTCMin,":",HEX2 RTCSec," ",HEX2 RTCMonth,"/",HEX2 RTCDate,"/",HEX2 RTCYear," Sample time = ",Dec SamTime," Sec >",10,10,13]
    If DirtyMem <> 255 Then
    Serout2 SO,32,[27,91,53,109," MEMORY Contains DATA!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    If TurStatus <> 255 Then
    Serout2 SO,32,[27,91,53,102," TURBINE IS DE-ACTIVATED!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    Serout2 SO,32,[ " (1) Turbine Setup Menu (2) Download Memory Banks",13,10]
    Serout2 SO,32,[ " (3) Erase Memory Banks (4) Set the sample time",13,10]
    Serout2 SO,32,[ " (5) Set the Clock (6) Log Data ("]
    If LogData = 1 Then 
    Serout2 SO,32,[ "ON)",13,10]
    Else
    Serout2 SO,32,[ "OFF)",13,10,13,10]
    EndIf
    
    Serout2 SO,32,[ " (C) CLEAR THE SCREEN",10,13]
    Serout2 SO,32,[ "HOLD (A) while LOGGING returns to this menu",13,10]
    SerIn2 SI,32,[PCCommand]
    If PCCommand = 49 Then TurbineSetup
    If PCCommand = 51 Then ClrMem
    If PCCommand = 53 Then SetClock
    If PCCommand = 52 Then SampleTime
    If PCCommand = 67 Or PCCommand = 99 Then Menu
    If PCCommand = 54 Then 
    If LogData = 0 Then LogData = 1:GoTo Menu
    If LogData = 1 Then LogData = 0:GoTo Menu
    EndIf
    If PCCommand = 50 Then
    Serout2 SO,32,[ 13,10]
    ADDR = 0
    Cont = Bank0A
    GoTo DumpMem
    EndIf 
    
    TurbineSetup:
    ClrMem:
    SetClock:
    SampleTime:
    Menu:
    DumpMem:
    And here is what it displayed ...

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3092" /><!-- Name:  Menu.gif
Views: 1963
Size:  15.8 KB -->

    The problem doesn't seem to be in that routine.
    Maybe somewhere else in the code?

    Need more Input.
    <br>
    DT

  8. #8
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Thanks Darrel

    Darrel, Thats exactly as it's supposed to look. Thank you for verifying the code. I wonder if you hit 'C' and clear the screen a bunch of times does it screw up the display for you?

    I will keep searching. That routine is was screws up on my end. if I try adding menu items (7) and (8) ect it really messes up.

    I will look at it much closer

    Thanks for taking the time Darrel

    Jamie

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jamied View Post
    I wonder if you hit 'C' and clear the screen a bunch of times does it screw up the display for you?
    The location MENU: (result of "C" PCCommand = 67) wasn't included in the snippet.
    Can I assume it's the routine shown?

    Happy to test any portions provided.
    <br>
    DT

  10. #10
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Sorry about that

    I just realized the menu: lablel was missing from the top of the text
    That whole routine is called menu so when you hit 'C' it just repaints it while clearing the screen
    I added the routine Clearscreen: a few weeks ago to try and solve my problem but it never helped.

    here it is


    DEFINE OSC 10

    SO VAR PORTC.6
    SI VAR PORTC.7


    RTCHr VAR BYTE : RTCHr = $17
    RTCMin VAR BYTE : RTCMin = $44
    RTCSec VAR BYTE : RTCSec = $28
    RTCMonth VAR BYTE : RTCMonth = 1
    RTCDate VAR BYTE : RTCDate = 3
    RTCYear VAR BYTE : RTCYear = 9
    SamTime VAR BYTE : SamTime = 12
    SYSVolts VAR BYTE : SYSVolts = 5
    DirtyMem VAR BIT : DirtyMem = 1
    TurStatus VAR BIT : TurStatus = 1
    LogData VAR BIT : LogData = 1

    PCCommand VAR BYTE : PCCommand = 0
    ADDR VAR BYTE : ADDR = 0
    Cont VAR BYTE : Cont = 0


    Menu:

    Serout2 SO,32,[27,91,48,109]
    GoSub ClearScreen:Serout2 SO,32,[27,91,48,109]

    Serout2 SO,32,[" ITCV2.0 Turbine Controller (SW - V1.0) System Voltage is ",Dec SYSVolts," Volts", 10,13]
    Serout2 SO,32,[" < ",HEX2 RTCHr,":",HEX2 RTCMin,":",HEX2 RTCSec," ",HEX2 RTCMonth,"/",HEX2 RTCDate,"/",HEX2 RTCYear," Sample time = ",Dec SamTime," Sec >",10,10,13]
    If DirtyMem <> 255 Then
    Serout2 SO,32,[27,91,53,109," MEMORY Contains DATA!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    If TurStatus <> 255 Then
    Serout2 SO,32,[27,91,53,102," TURBINE IS DE-ACTIVATED!",27,91,48,109,10,10,13] ' flash the text
    EndIf
    Serout2 SO,32,[ " (1) Turbine Setup Menu (2) Download Memory Banks",13,10]
    Serout2 SO,32,[ " (3) Erase Memory Banks (4) Set the sample time",13,10]
    Serout2 SO,32,[ " (5) Set the Clock (6) Log Data ("]
    If LogData = 1 Then
    Serout2 SO,32,[ "ON)",13,10]
    Else
    Serout2 SO,32,[ "OFF)",13,10,13,10]
    EndIf

    Serout2 SO,32,[ " (C) CLEAR THE SCREEN",10,13]
    Serout2 SO,32,[ "HOLD (A) while LOGGING returns to this menu",13,10]
    SerIn2 SI,32,[PCCommand]
    If PCCommand = 49 Then TurbineSetup
    If PCCommand = 51 Then ClrMem
    If PCCommand = 53 Then SetClock
    If PCCommand = 52 Then SampleTime
    If PCCommand = 67 Or PCCommand = 99 Then Menu
    If PCCommand = 54 Then
    If LogData = 0 Then LogData = 1:GoTo Menu
    If LogData = 1 Then LogData = 0:GoTo Menu
    EndIf
    If PCCommand = 50 Then
    Serout2 SO,32,[ 13,10]
    ADDR = 0
    Cont = Bank0A
    GoTo DumpMem
    EndIf


    ClearScreen:
    serout2 SO,32,[27,91,50,74]
    Return



    TurbineSetup:
    ClrMem:
    SetClock:
    SampleTime:
    Menu:
    DumpMem:

  11. #11
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Still no problems Jamie.

    I get the same screen, and when pressing C it redraws the screen.

    Doesn't matter how many times or how fast I press C, it always comes up correct. I can press C fast enough that it misses some of them, but that's to be expected with SERIN2.

    Do you have any other ANSI sequences in your program?
    <br>
    DT

  12. #12
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default Thanks Darrel

    No, thats the whole routine. I'm going to reinstall hyper terminal. This glitch never made any sense to me. Thank you for all your help!!!!
    I know its not the code now. I'll update when I get it squared away.. has to me my pc.

    Jamie

  13. #13
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Jumping in late here with a quick thought....
    Are you by any chance using a USB<->RS232 dongle? I've never had a problem with those myself but I've read about some weird behaviour. I know you said that the transfer was rock solid "otherwise" which may point away from said dongle - but then it would point away from the PC and terminal softwaret too.

    Anyway, just a thought.

    /Henrik.

Similar Threads

  1. load .hex file in PIC with hyperterminal
    By irenuska23 in forum General
    Replies: 8
    Last Post: - 1st September 2009, 09:52
  2. Hyperterminal problem
    By DR.Larq in forum Serial
    Replies: 2
    Last Post: - 9th May 2008, 18:40
  3. Replies: 1
    Last Post: - 30th March 2008, 15:53
  4. Sending menu to PC from PIC16F876A
    By joseph Degorio in forum Serial
    Replies: 2
    Last Post: - 12th November 2007, 07:03
  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 : 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