Shop OBEX P1 Docs P2 Docs Learn Events
pipe commands to propellor on USB from command prompt? — Parallax Forums

pipe commands to propellor on USB from command prompt?

2coolcode2coolcode Posts: 5
edited 2013-09-10 03:37 in Propeller 1
Is it possible to communicate to the program on the propeller while connected to the USB via my command prompt? For example if I wrote a program that blinks a led based on a keyboard input , has anyone ever been able to execute this program via command prompt when the propeller is connected to the computer via USB (comport) .. or is the only way to attach a keyboard and lcd/vga display to the board , or use the terminal window in the simpleide compiler?

Comments

  • __red____red__ Posts: 470
    edited 2013-09-04 06:45
    You can certainly read and write to the USB serial port from the command line in most modern OSs.

    Which OS are you wanting to do this from?
  • jazzedjazzed Posts: 11,803
    edited 2013-09-04 08:58
    Commands can be piped via the OS, the easiest is to send commands to propeller cat > /dev/ttyUSB0 or copy con com8 for example. It may be that receiving chars back from propeller will require some kind of terminal program (someone else can show us how to go both ways with various OS built-in tools).

    You can use any terminal program you like to talk to propeller.

    One option since you don't mind using the command line is to use the propeller-load terminal.

    For example:

    1. Open Documents\SimpleIDE\My Projects\Welcome.side
    2. Compile the program by clicking the hammer at the top of the IDE.
    3. Open a command window to Open Documents\SimpleIDE\My Projects\Welcome
    4. Enter this: propeller-load -r -t cmm/Welcome.elf

    propeller-load -r -t cmm/Welcome.elf loads the Welcome program from the cmm output folder to propeller ram (-r) and uses the built-in terminal (-t). Press ESC to exit the program.

    Once you've done that, add code to read from the serial port using getChar() or other methods.

    BTW, just for precise understanding SimpleIDE just calls the propeller-gcc compiler to build programs. All of the steps and results for building programs can be found in the Build Status pane (open with the little green+ hammer in the status bar).
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-04 09:05
    Any of the versions of Forth on the Propeller can do this very easily. And you can reprogram via the USB port as well.. they are interpreted language

    Try either PropForth, pfth, or Tachyon.
  • jazzedjazzed Posts: 11,803
    edited 2013-09-04 09:10
    Any of the versions of Forth on the Propeller can do this very easily. ...

    Sure, but what do you use on the PC side?
  • SRLMSRLM Posts: 5,045
    edited 2013-09-04 11:12
    Don't think of it as piping to the Propeller, but as piping to a program on the computer that just happens to interface to the Propeller. On Ubuntu I use picocom to interface a PC program to the Propeller. You set it up exactly like you would expect with any other program that interfaces via STDIO.

    For example, to use propeller-load from python you could do something like:
    os.system("/opt/parallax/bin/propeller-load -r -q -t115200 main.elf")
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-09-04 18:34
    jazzed wrote: »
    Sure, but what do you use on the PC side?

    What do you mean, on the PC side? If you are running a "terminal" on the PC side in which the "command prompt" appears then there is only the USB to serial connection which is built into a lot of Prop boards or else a USB serial cable. The "very easily" is just that.

    BTW, a terminal program such as minicom or TeraTerm etc are more than suitable.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-09-10 03:37
    On the PC side, you can use scripts.

    Windows may have pretty much hidden away its scripting ablilites and command prompt. They also migrated away from DOS.

    But in Linux, the end user easily can do a heck of a lot with scripts band redirect output to a serial port (or USB serial port), instead of the Standard Output (which is the Terminal Window.

    I suspect that you are a Windows user. That might well be the reason that you asked.
Sign In or Register to comment.