Define display position for 1st character


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2008
    Location
    Washington
    Posts
    14

    Default Define display position for 1st character

    I am migrating code from a Parallax Basic Stamp to a PIC. I am using Pic Basic Pro. I have code that works on the basic stamp when using the parallax debug window, but when I try the same thing using Pic Basic Pro and output to hyperterminal, I am not getting the result I want. I don't know if it is a code issue or if it is a feature built into the basic stamp debug window that I can't duplicate using hyperterminal.

    Here is the code

    FOR memread = 1 TO 50
    pulsin PORTA.0,1,xpulse
    pulsin PORTA.1,1,ypulse
    serout PORTC.6,N2400,[2,0,11] 'code to determine stating point on display
    serout PORTC.6,N2400,["-----------------",10,13]
    serout PORTC.6,N2400,["X Pulse = ",#xpulse,10,13]
    serout PORTC.6,N2400,["Y Pulse = ",#ypulse,10,13]
    PAUSE 250
    NEXT memread
    Goto loop ' Do it forever


    So...what I am trying to do is have the serout for each loop to overwrite the previous output so that the display does not scroll. Using the parallax, the line
    serout PORTC.6,N2400,[2,0,11] defines the starting point of the output on the debug termnal. With the basic stamp, the 2 is the command is ASCII for start of text. the 0 and 11 are the x and y coordinates of the starting pooint.

    so 2 questions

    1) Does anyone know if I can define the starting point of output to hyperterminal so I can overwrite the previous output?

    2) If so, can you help me get there? Maybe I need different settings in hyperterminal or ???



    Thanks

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    At the end of each one of your lines, you use 10 (line feed) and 13 (carraige return).
    Skip the line feed, and your 'cursor' will return to the left edge without the line feed.
    Code:
       FOR memread = 1 TO 50
            pulsin PORTA.0,1,xpulse
            pulsin PORTA.1,1,ypulse
            serout PORTC.6,N2400,[2,0,11]    'code to determine stating point on display
            serout PORTC.6,N2400,["-----------------",13]
            serout PORTC.6,N2400,["X Pulse = ",#xpulse,13]
            serout PORTC.6,N2400,["Y Pulse = ",#ypulse,13]
            PAUSE 250
        NEXT memread       
            Goto loop	' Do it forever

  3. #3
    Join Date
    Jun 2008
    Location
    Washington
    Posts
    14

    Default

    Thanks Skimask,
    but I have several lines I am trying to "refresh". so I'm trying to get the display to read

    X pulse = xxxxx
    Y pulse = yyyy

    and then overwite this with each loop. That way as the values of xxxx and yyyy change, it just looks like they are updating. when I remove the 10 (line feed), the x pulse and y pulse overwrite each other and the diplay alternates back and forth. I am hoping to update these values 5-10 times per second, so if I don't keep them seperate, I can't watch whats going on.

    Any other suggestions?

    Thanks,

    Clay

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Code:
       FOR memread = 1 TO 50
            pulsin PORTA.0,1,xpulse
            pulsin PORTA.1,1,ypulse
            serout PORTC.6,N2400,[2,0,11]    'code to determine stating point on display
            serout PORTC.6,N2400,["-----------------",13]
            serout PORTC.6,N2400,["X Pulse = ",DEC5 xpulse,13]
            serout PORTC.6,N2400,["Y Pulse = ",DEC5 ypulse,13,10]
            PAUSE 250
        NEXT memread       
            Goto loop	' Do it forever
    Last edited by skimask; - 27th June 2008 at 18:54.

  5. #5
    Join Date
    Jun 2008
    Location
    Washington
    Posts
    14

    Default

    Did your code examples work for you, because I can't get them to do what I am trying to accomplish?

    Thanks

  6. #6
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by ClayE View Post
    Did your code examples work for you, because I can't get them to do what I am trying to accomplish?

    Thanks
    Nope, haven't tried, don't have your circuit, which by the way isn't described.
    I'm throwing suggestions...
    Skip the pulsin and substitute raw numbers.
    Break it down...make it stupid simple...then build 'er back up to what you need...
    And rethink the way I removed the "10" from each of your lines.
    I left a little bug in there for you to figure out, specifically:
    when I remove the 10 (line feed), the x pulse and y pulse overwrite each other and the diplay alternates back and forth.
    Think about it...if you remove the line feed in between x and y, what'll happen?
    Last edited by skimask; - 28th June 2008 at 07:27.

  7. #7
    Join Date
    Jun 2008
    Location
    Washington
    Posts
    14

    Default

    I just ended up using the debug terminal program with came with my parallax basic stamp. problem solved.

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 20:30
  2. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  3. RS232 comm
    By longdw in forum Serial
    Replies: 9
    Last Post: - 15th September 2009, 03:13
  4. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  5. Need idea hove to..?
    By phoenix_1 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 14th May 2008, 18:41

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