Shop OBEX P1 Docs P2 Docs Learn Events
BASIC Stamp Code to SX — Parallax Forums

BASIC Stamp Code to SX

ajajackajajack Posts: 26
edited 2007-09-07 21:38 in General Discussion
Hello,

I am working·on a wireless project in which I want to wirelessly send data from my BASIC Stamp to my SX28AC/DP chip.· Here is the website where I bought the transmitter and reciever and found the code:· http://www.rentron.com/Stamp_RF.htm

Transmitter:
The BS1 Code:
symbol dat = b2symbol synch = b3symbol junk = b4synch = "A"junk = 126start[noparse]:p[/noparse]ause 1000for dat = 1 to 255 serout 0,N2400,(junk,synch,dat) pause 50next serout 0,N2400,(junk,synch,0) goto start

Reciever:

The Receiver Code:

' RF test program' This test program is for the RF receiver.' The serial input routine waits until the' letter "A" is received before processing' further incoming serial data. This method' allows us to synchronize the receiver to' the transmitter, and avoid false receptionsSYNCH CON "A" 'Establish synchronization byteBAUD CON 16780 'N2400 baud (MAX)DAT VAR byte 'Data storage variableDIRH = %11111111 'All outputsSTART: SERIN 0,BAUD,[noparse][[/noparse]WAIT(SYNCH),DAT] OUTH = dat GOTO START

I want to convert the Receiver Code to my SX chip.· Does anybody have any ideas?

Thanks for your help!

-Andrew

Comments

  • JonnyMacJonnyMac Posts: 9,216
    edited 2007-09-07 21:02
    I've translated your receiver code to SX/B -- see attached. Make sure you have SX/B 1.51.03 before attempting to compile this program. Note, too, that SERIN and SEROUT require an external clock source, you cannot use the internal 4 MHz oscillator.

    Post Edited (JonnyMac) : 9/7/2007 9:09:49 PM GMT
  • ajajackajajack Posts: 26
    edited 2007-09-07 21:07
    Thank You for your response but I am confused about what speed external clock I need.
  • JonnyMacJonnyMac Posts: 9,216
    edited 2007-09-07 21:12
    You can use a 4 MHz resonator, or a 20 or 50 -- but if you use either of the latter two you'll need to update the FREQ directive in the program.
  • Ken GraceyKen Gracey Posts: 7,404
    edited 2007-09-07 21:13
    ajajack,

    You need one of these: http://www.parallax.com/detail.asp?product_id=250-04050

    Jon·specified in your code that this frequency would be used.

    Ken Gracey
    Parallax, Inc.
  • Ken GraceyKen Gracey Posts: 7,404
    edited 2007-09-07 21:14
    And the other two Jon mentioned can be found here:

    http://www.parallax.com/sx/resonators.asp

    Ken Gracey
  • ajajackajajack Posts: 26
    edited 2007-09-07 21:19
    What would my connections look like if I used the 4 MHz resonator? I mean, where would it fit in? Also, I was wondering if you could convert the Transmitter to SX code as well that way if I wanted flip my design.

    Post Edited (ajajack) : 9/7/2007 9:29:54 PM GMT
  • Ken GraceyKen Gracey Posts: 7,404
    edited 2007-09-07 21:38
    ajajack,

    If you are using the SX Tech Board then put it into the socket as shown on page 17 of the following document http://www.parallax.com/dl/docs/prod/sx/SXKeyMan2_0.pdf.

    Page 147 of the same document shows the schematic for this board, which also shows you how to connect the resonator to your SX chip.

    As for the code conversion of the second program, there's nearly enough hints in the example Jon provided to translate the second program.

    Ken Gracey
Sign In or Register to comment.