Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp Code and see what it would be in SX code — Parallax Forums

Basic Stamp Code and see what it would be in SX code

sam_sam_samsam_sam_sam Posts: 2,286
edited 2008-07-23 18:16 in General Discussion
I want start using the sx because I want to learn to use interrupts and timers

I have a SX28 Proto Board and a SX48 Proto Board as well and The SX-Key USB



I read some where on the fourm that you can take a Basic Stamp Code and see what it would look like in SX Code

Could some one explane in detail how I would do this

I read this post

http://forums.parallax.com/forums/default.aspx?f=15&m=280614

T&E Engineer

You may want to do a search on this forum on comparing SX chips using SX/B to Basic Stamps using PBASIC. Basic Stamps or Basic Stamp 2 are for beginners. They make programming easy but are limited in speed and provide no interrupts as compared to SX chips like the SX28 and SX48. I started with a Basic Stamp 2 (BS2) and moved up to a BS2px because I needed more speed in one application but later needed interrupts so I took the plunge and learned SX/B. SX/B is not that much different than PBASIC for the BS2 series

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-23 18:08
    In the SX forum, there's a "sticky thread" where you can download the SX/B compiler. This form of Basic is intentionally very close to Stamp Basic and you should be able to compile your Stamp Basic program with very few changes, then look at the produced assembly language. There are also several SX/B textbooks you can download from Parallax as well as some Nuts and Volts columns on the subject which should all help to get you started.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-07-23 18:16
    I think that the specific example programs in PBasic and the SX/B are the best place to start comparing. They certainly are very similar.

    Timers come in two flavors - software [noparse][[/noparse]on the SX28] and hardware [noparse][[/noparse]on the SX48].

    Software timers are really quite easy. They just count off so many clock cycles before they jump out of a loop. With 8 bits that can be way too fast, so the real trick is to pass over a count from one byte to another to make a 16 bit counter. It isn't hard and you get exact timing.

    Once you understand the concepts and details, you can get longer and longer cycles by going to 24bit, 32bit, and so on.

    If you need to time two different intervals, you can have the shorter counter inside the longer counter.

    It gets easy once you do it. Guenther's SX text is terrific.· The hardware timers are best left until last as very little has been written about them. Mostly the original PDFs explain them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Kramer) : 7/23/2008 6:21:55 PM GMT
Sign In or Register to comment.