Shop OBEX P1 Docs P2 Docs Learn Events
New here — Parallax Forums

New here

slipslip Posts: 2
edited 2007-03-09 01:03 in General Discussion
Hi all,

I am new to the SX microcontroller. The past few years I have primarily used AVR's. But I must admit, this device is attractive. At first I was put off by the program size of the SX28, but after compiling a few sample basic programs, I could see that there was still a lot of program space remaining. I am going to get an SX28 proto board and a SX-Blitz to get a feel for the device. I really like the SX/B language features. smile.gif

Comments

  • JonnyMacJonnyMac Posts: 8,943
    edited 2007-03-09 01:03
    Slip,

    Remember that SX/B is a "compile in place" compiler, so if you encapsulate "big" instructions (things like PAUSE, SEROUT, SERIN, etc.) into subroutines and functions you'll save a lot of space. Since delays are a part of nearly every program I always have this subroutine in my code:

    ' Use: DELAY_MS msecs
    
    DELAY_MS:
      IF __PARAMCNT = 1 THEN
        tmpW1 = __PARAM1                            ' save byte value
      ELSE
        tmpW1 = __WPARAM12                          ' save word value
      ENDIF
      PAUSE tmpW1 
      RETURN
    
    



    By using the __PARAMCNT variable (set by the compiler before the call) the subroutine can tell adjust for a byte or word being sent, and then do the PAUSE.
Sign In or Register to comment.