Shop OBEX P1 Docs P2 Docs Learn Events
Serial Comm — Parallax Forums

Serial Comm

electric550electric550 Posts: 122
edited 2009-04-11 06:41 in Propeller 1
The return character in the below code from Web-PELabsFunBook is not working in HyperTerminal...Is there some setting I need to change?

'' File: EnterAndDisplayValues.spin
'' Messages to/from Propeller chip with Parallax Serial Terminal. Prompts you to enter a
'' value, and displays the value in decimal, binary, and hexadecimal formats.
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
Debug: "FullDuplexSerialPlus"
PUB TwoWayCom | value
''Test Parallax Serial Terminal number entry and display.
Debug.start(31, 30, 0, 57600)
waitcnt(clkfreq*2 + cnt)
Debug.tx(16)
repeat
Debug.Str(String("Enter a decimal value: "))
value := Debug.getDec
Debug.Str(String(13, "You Entered", 13, "
"))
Debug.Str(String(13, "Decimal: "))
Debug.Dec(value)
Debug.Str(String(13, "Hexadecimal: "))
Debug.Hex(value, 8)
Debug.Str(String(13, "Binary: "))
Debug.Bin(value, 32)
repeat 2
Debug.Str(String(13))


And also I was wondering if there was a decent example of multiple cogs running assembly code sending values to central memory, and having one cog just reading those values and sending them out serially. I am planning on having a couple cogs running some IO, and they all need to communicate with one computer over serial. I figure running multiple serialcoms would step on each other, plus i think I saw this done somewhere on here I am just having trouble finding a good example. Anyways if someone could point me to a solution I would appreciate it thanks!

Comments

  • Earl FosterEarl Foster Posts: 185
    edited 2009-04-10 23:28
    The code works.· Did you indent under the repeat commands like this?
    '' File: EnterAndDisplayValues.spin
    '' Messages to/from Propeller chip with Parallax Serial Terminal. Prompts you to enter a
    '' value, and displays the value in decimal, binary, and hexadecimal formats.
    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    OBJ
    Debug: "FullDuplexSerialPlus"
    PUB TwoWayCom | value
    ''Test Parallax Serial Terminal number entry and display.
    Debug.start(31, 30, 0, 57600)
    waitcnt(clkfreq*2 + cnt)
    Debug.tx(16)
    repeat
      Debug.Str(String("Enter a decimal value: "))
      value := Debug.getDec
      Debug.Str(String(13, "You Entered", 13, "--------------"))
      Debug.Str(String(13, "Decimal: "))
      Debug.Dec(value)
      Debug.Str(String(13, "Hexadecimal: "))
      Debug.Hex(value, 8)
      Debug.Str(String(13, "Binary: "))
      Debug.Bin(value, 32)
      repeat 2
        Debug.Str(String(13))
    

    Here is a sample output using the Parallax Serial Terminal

    You Entered
    Decimal: 8
    Hexadecimal: 00000008
    Binary: 00000000000000000000000000001000
    Enter a decimal value:

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
  • JomsJoms Posts: 279
    edited 2009-04-10 23:39
    Instead of using HyperTerminal try using the Parallax Serial Terminal that Earl mentioned above.· It does not require any install.· Although it doesn't have all the features HyperTerminal has, I like it a lot better for simple tasks.

    I have attached the program because it was faster then finding a link to it on the site.·
    exe
    230K
  • electric550electric550 Posts: 122
    edited 2009-04-10 23:57
    Sorry the code came out wrong...but the indention is there in the code I am using. The reason I wanted to make sure everything is working in hyper term is because I will be using the code in the future to connect to c program on a computer...so if it only works in the parallax version of the Serial terminal i fear that I will be running into problems later. If there is no easy solution to getting it to work in hyper term i will just deal with that problem when i get to it later. thanks for the help so far!
  • JomsJoms Posts: 279
    edited 2009-04-11 02:43
    Hyperterm and PST are basically the same thing.... If it works in PST then you shouldn't have any problem makeing it work later with your C program. The nice thing that PST does is it gives you two seperate windows to show transmit and receive. It is also nice because you can use the same pins 30/31, probably through a prop plug, so it takes care of all the level switches.

    Dont forget that the serial port runs at a different voltage then the prop and can damage the prop if hooked directly to the computers comm port. You may already know that, but I got in a hurry awhile back and plain forgot that step. Also, when going through a level change device you might need to change the mode, such as invert TX or RX.

    Example... When I was trying to use hyperterminal I had to change the mode to '2'.
    Debug.start(31, 30, 2, 57600)

    Just throwing out few more ideas that might help...
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-04-11 06:16
    Hello elctric550,

    if you want to analyse every single byte received regardless of its value you can use bray's terminal for this

    In brays terminal you can watch the incoming data as characters, hex, decimal or binary code
    and you can even watch then all at the same time
    you can log to a file

    I have attached a zipfile with the software
  • electric550electric550 Posts: 122
    edited 2009-04-11 06:38
    Thanks that is a nice program
  • electric550electric550 Posts: 122
    edited 2009-04-11 06:41
    The data shows up in hyperterminal it just writes over it self, I was just wondering why the carriage return was not working...thanks for the info good stuff...hopefully I wont have to worry about that later anyways.
Sign In or Register to comment.