PDA

View Full Version : Define display position for 1st character



ClayE
- 27th June 2008, 17:57
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

skimask
- 27th June 2008, 18:05
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.


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

ClayE
- 27th June 2008, 18:41
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

skimask
- 27th June 2008, 18:52
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

ClayE
- 27th June 2008, 22:22
Did your code examples work for you, because I can't get them to do what I am trying to accomplish?

Thanks

skimask
- 28th June 2008, 06:22
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? :D

ClayE
- 30th June 2008, 16:33
I just ended up using the debug terminal program with came with my parallax basic stamp. problem solved.