PDA

View Full Version : PropTerminal and Propeller from command line



lfreeze
05-16-2008, 02:05 AM
I am not sure if this post belongs in the propeller forum or the sand box.

I amusing a simple batch file on my desktop and using windows xp, task scheduler,
starting propterminal and downloading data from the propeller to the desktop at a fixed time each day. I was successfull with this, but now I want to start the propterminal from the command line
with the data being saved to a file on the desktop. I am not sure if this possible and would appreciate
any suggestions.Below is the batch file.

echo off
cd c:\program files\parallax inc\propeller tool v1.1\my programs
propterminal.exe

Thanks in advance////
Larry

Ariba
05-16-2008, 04:02 PM
Hello Larry

It should be doable.
First you need a Spin program that uses PropTerminal to saves the data to a File on the Desktop. Here is a simple example, which produces a small textfile and save it (path is for my computer and a Swiss Window version, so change it to your Desktop path):


{{ Save to Desktop Test }}

CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

VAR
long filename

OBJ
pc : "PC_Text"

PUB main | i
pc.start(12)

' path and filename (customize it for your Desktop location)
filename := string("C:\Dokumente und Einstellungen\insonix\Desktop\TEST2.TXT")

' produce some Text data lines (max 32kByte)
pc.out(0)
repeat i from 1 to 40
pc.str(string("Save-Test Line: "))
pc.dec(i)
pc.out(13)

' save it to Desktop
pc.out(1) 'save file command sequence
pc.str(filename) 'for PropTerminal
pc.out(5)
pc.out($82)
pc.out(strsize(filename))
pc.out("s")

repeat



If it works in the Propeller Tool, you can save it as .binary (F8 and then "Save Binary"). Save the binary in the same Directory as the PropTerminal is. Now Edit the PropTerminal.ini file. Write the filename of your binary behind the entry Autoload= (for example: Autoload=SaveTest.binary.
When you now start PropTerminal, the binary is automatically uploaded to the Propeller RAM and started. The Propeller then saves the data to the Desktop. This works also if you start PropTerminal from Commandline, in this case you can have a special .ini file, only for that Desktop saving, and start PropTerminal with this ini-filename as parameter:


PropTerminal.exe Inifilename.ini




Andy

lfreeze
05-16-2008, 08:29 PM
Andy,

Thank you very much for your help. I will try this today.

Larry

datac99
05-17-2008, 01:37 AM
Pretty sure you need to put " around the string to launch the propterminal in your .bat.

Nope... I take it back... Since you CD in before running the command it should work just fine... My mistake...

Post Edited (datac99) : 5/16/2008 5:43:08 PM GMT

lfreeze
05-18-2008, 01:12 AM
Hello Andy,

I had time this morning to test the program and ran into some problems.
I took your sample program and changed the address of the save file to my directory (copy below). I then saved
it as binary file in the same directory as propterminal. I then edited and saved the ini to autoload
the saved binary file. I ran propterminal and it produced the following result:

Start Upload
Time Out
Code Error -> Abort˜™ݻ™ݻ™ٺ™™ݻ™™™ݻݺ™™ݻ ٺ™™ݻ™™™ݻݺ™™ݻٺ›™ݻ™ ™›;;;;™;™:™:™:™:™:™:™:›:›]]]]];;;;;;;;;:™:™:™:™: ™:™:™:›]]]YY;;;;;;;;;™::™:™:™:™:™: ™:›:]]]]];;;;;;;;;™:™:™:™: ™:™:™:›:›]]]Y;;;;;;;;;::™:™:™:›

I checked if by luck any file was save to pc and found none. It appears propterminal is autoloading the saved binary
file to the propeller and I have some timing issue. I hope you have a suggestion, as I am at the outer limit
of my skills with programming.

_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

VAR
long filename

OBJ
pc : "PC_Text"

PUB main | i
pc.start(12)

' path and filename (customize it for your Desktop location)
filename := string ("C:\documents and settings\owner\my documents\TEST2.TXT")

' produce some Text data lines (max 32kByte)
pc.out(0)
repeat i from 1 to 40
pc.str(string("Save-Test Line: "))
pc.dec(i)
pc.out(13)

' save it to Desktop
pc.out(1) 'save file command sequence
pc.str(filename) 'for PropTerminal
pc.out(5)
pc.out($82)
pc.out(strsize(filename))
pc.out("s")

repeat

Vielen Dank
Larry

Ariba
05-18-2008, 01:37 AM
Do you have a PropTerminal version 0.4 or higher? And have you set the right COM Port in the INI file? It seems the Binary upload to the Propeller does not work!
Have you tried to upload the code example from the PropellerTool (with F10), with that you should also get the Text File on your PC.
If this works, remove the filename behind "Autoload=", and try to Upload the binary with PropTerminal manually (Menu: File -> Upload).

If the Upload with PropTerminal really not works, then perhaps it works with the code stored to the EEPROM and only start PropTerminal
with the batch file. At start normally a Reset happens, and so your code ist executed from the EEPROM, sends the data to PropTerminal, which stores it as textfile.

Andy

lfreeze
05-18-2008, 03:11 AM
Andy,

I am using propterminal ver 0.4.1. Here is the INI I am using:

/* PropTerminal Settings v0.1 */'
[Config]
ComNr=1
FT232R=0
BinPath=
AutoDis=1
VKeys=0
TxtCurs=0
MsMoveOff=1
BaudRate=4
Rows=20
Cols=50
Autoload=savetest.binary
[Colors]
pal_0=#FFFFFF
pal_1=#FFFF00
pal_2=#0000FF
pal_3=#FF00FF
pal_4=#FF0000
pal_5=#00FF00
pal_6=#00FFFF
pal_7=#C0C0C0

I believe I have the correct com port setting as I am getting a result when I call Propterminal. For purposes of testing
I will now use only "save to desktop test" program you sent me and forget about starting it from the command line until
this it is fixed.
I am really confused about why it does not work. I am
thinking that perhaps the path I have for the save file is not valid. I will try some variations and see if that will
solve it .
Thanks again for spending your time to help me solve this.
Larry

lfreeze
05-18-2008, 08:18 PM
Andy,

Success ! I went over everything and found that I had the "normal terminal Mode" option checked on the Propterminal
screen. When I unchecked it, the program ran without problem. I then plugged the entire application into windows
task scheduler and ran several tests every few minutes. It worked without problem. I can now schedule routine timed
downloads of what the propeller is doing and save this information to a file on the desktop. From this point I can
create an e-mail messages and broadcast the saved file as an attachment, all under program control.

Thank you again for all your help. It would not have been possible for me to create this application
without your assistance.

Larry

Ariba
05-19-2008, 12:30 AM
Gern geschehen http://forums.parallax.com/images/smilies/wink.gif