PDA

View Full Version : Basic stamp to propeller tool-not from object exchange



07-15-2009, 01:50 AM
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

Leon
07-15-2009, 02:13 AM
You need to rewrite it in Spin.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

07-15-2009, 02:40 AM
i know can u help me write it in spin

ProcessingData...
07-15-2009, 02:45 AM
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 Green
07-15-2009, 02:47 AM
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.

07-15-2009, 02:56 AM
i know. can u help me write it in spin

Oldbitcollector (Jeff)
07-15-2009, 03:09 AM
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 (http://www.warrantyvoid.us/tiki-index.php?page=Propeller) @ Warranty Void.

ProcessingData...
07-15-2009, 03:17 AM
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



JonnyMac
07-15-2009, 07:14 AM
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.