Shop OBEX P1 Docs P2 Docs Learn Events
Basic stamp to propeller tool-not from object exchange — Parallax Forums
Options

Basic stamp to propeller tool-not from object exchange

edited 2009-07-14 23:14 in Propeller 1
here is the code written in basic stamp. Does anyone know how to write this code in propeller tool.

Program Code:

LOW Tx 'Initialize transceiver interface
DO
idx = Message 'Point idx to start of message data
DO
strLen = 0 'Set string length to zero
crc = 0 'Start Crc at zero
DO
strLen = strLen + 1
READ idx, char 'Read a character from message data
idx = idx + 1 'Point to next character in message
string(strLen-1) = char 'Put character into string array
cValue = char 'Prepare to add char to Crc value
GOSUB CalcCRC 'Add cValue to Crc value
IF (strLen = 15) OR (char = EOM) THEN EXIT 'Exit loop when ready
LOOP 'Keep reading message characters
' Send packet
PULSOUT Tx,1200 'Send sync pulse to radio
' Send preample "UUUU!", string length, string data, crc
SEROUT Tx, Baud, ["UUUU!", strLen, STR string\strLen,
crc.LOWBYTE, crc.HIGHBYTE]
PAUSE 1000 'Give receiver time to process
LOOP WHILE char <> EOM 'Keep sending until EOM character
LOOP 'Start all over at the beginning

Comments

  • LeonLeon Posts: 7,620
    edited 2009-07-14 18:13
    You need to rewrite it in Spin.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • edited 2009-07-14 18:40
    i know can u help me write it in spin
  • ProcessingData...ProcessingData... Posts: 208
    edited 2009-07-14 18:45
    I would love to help you, But could you please post the rest of the code?

    (Variables, Constants, Data arrays, ect.)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Basic Stamp,···· Propeller,·· · SX,·· FUN!


    START:·
    >Proccessing Data. . . .··
    >Task Complete. . .·.
    >Saving Data. . . .
    >Entering SLEEP Mode. . . .
    >Signing OFF


    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-14 18:47
    If you're asking someone to rewrite it in Spin for you ... the answer is no.

    If you're asking for help, the answer is yes, of course, but that means that you have to learn what that piece of program does in Basic, you have to actually learn how to program in Spin, and you have to rewrite that piece of program in Spin and we'll give you advice, suggestions, help clear up misunderstandings, etc.

    You need to start with a description of what you want that piece to do, a description of the input data, and the output data.
  • edited 2009-07-14 18:56
    i know. can u help me write it in spin
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-07-14 19:09
    This post sounds a bit like a request to do some homework.. <SMIRK>

    No, you won't find many who will write it for you, but there are MANY who will help you if
    you get started and get stuck. Download the Propeller Tool. There is a copy of the
    SPIN manual included. Take the plunge...

    Take a look at FullDuplexSerial from the Object Exchange.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • ProcessingData...ProcessingData... Posts: 208
    edited 2009-07-14 19:17
    I have already written half of it it spin, but I'm not going to just give it to you. I want you to learn! (Oh the joys of spin....)
    I will tell you this though, Sending something serial and sending pulses with the propeller take a lot more code than just "Debug("UUUUU!") or "PULSOUT Tx,1200. It's more like "Ser.start(rx, tx, 9600, 1, 0, 1), Ser.str(string("UUUU!")).
    On the Basic Stamp, Chip has done all the hard work for you!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Basic Stamp,···· Propeller,·· · SX,·· FUN!


    START:·
    >Proccessing Data. . . .··
    >Task Complete. . .·.
    >Saving Data. . . .
    >Entering SLEEP Mode. . . .
    >Signing OFF


    ·
  • JonnyMacJonnyMac Posts: 9,197
    edited 2009-07-14 23:14
    I would actually use SimpleSerial instead of FulDuplexSerial -- that will allow you to manually "blip" the TX line (PULSOUT in your BS2 program) and then send data after; SimpleSerial can transmit up to 19.2K baud so you're covered.
Sign In or Register to comment.