May 02, 2024, 01:02:15 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Testing basic setup for beginning SX programmers.

Started by migman, September 19, 2010, 01:35:14 PM

Previous topic - Next topic

migman

September 19, 2010, 01:35:14 PM Last Edit: September 20, 2010, 03:21:35 PM by migman
Jon,
 I looked at the documentation that is on the forum download site.  I found the code that you wrote BLINK.SXB as part of the introduction to SX programming.  it was simple:

' BLINK1.SXB
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
Led PIN RA.0
PROGRAM Start
Start:
HIGH Led
PAUSE 500
LOW Led
PAUSE 500
GOTO Start

I then wrote the following e-mail:

Jon,
 I have entered the code for the BLINK.SXB into the SX/B compiler.  I was able to get it to successfully compile and the "Program" part went successfully.  I tried to "RUN" the program and was informed that the SX/Blitz doesn't support that function.   As I read on in the introduction to programming I noticed that after the program successfully "PROGRAMS" that the "LED" should be blinking.   I have a Prop-SX Controller from EFX-TEK not one of the development boards from Parallax as the document describes.  I figured that since I'm trying to drive an LED, I should be able to put my PROP-1 Trainer that I modified to disconnect the POT from pin 7 and since the pushbutton on pin 6 is normally open the board should be an easy LED indicator.  I installed it on the p0 – p7 WRB block just like one would do on a Prop-1.  Am I missing something?  I don't see any flashing LED!  I'm just trying to do something simple to see if I have everything in place to actually program one of these SX prop controllers for an actual project.
you replied:


It's really difficult to assist with code when you don't provide code!
<wink>

Thanks.

Jon


Since I have now posted the program and done it on the forum could you address the question about the prop-1 trainer being used to test this program.

JonnyMac

There's no need to post your email -- asking the question, simply and plainly, is enough.  That said, this is a multi-part thread which is difficult for others to search on.  In future, please restrict each thread to one question.  Managing these forums and providing no-charge programming services is tough; please help us by following our simple guidelines.

1. Trainer: I happened to use a [modified] trainer on a Prop-SX this morning; no problem.  

The reason you're not seeing anything is that your program is using RA.0 (which corresponds to the onboard serial port).  You see, I needed to see the code to determine the problem.  ;)  Just to ensure I was doing as you are I did in fact program the board with a Blitz instead of a Key.

For P0..P7 you need to use the RB port, for P8..P15 you need to use the RC port.  Here's a little demo that uses all the LEDs on the Trainer.  This program is setup for RC so that I can use the SETUP jumper to pull the trigger pin down (I don't have a ULN installed at the moment).

' =========================================================================
'
'   File...... zipper.sxb
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
' =========================================================================


' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Conditional Compilation Symbols
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------

ID              "Zipper"

DEVICE          SX28, OSC4MHZ, BOR42
FREQ            4_000_000


' -------------------------------------------------------------------------
' I/O Pins
' -------------------------------------------------------------------------

Trigger         PIN     RC.6 INPUT              ' P15 SETUP = DN (trainer)

Leds            PIN     RC                      ' P8..P13 (trainer)


' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------

IsOn            CON     1
IsOff           CON     0


' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------

dbTimer         VAR     Byte
channel         VAR     Byte


' =========================================================================
' Subroutine / Function / Task Declarations
' =========================================================================

DELAY_MS        SUB     2, 2, Word, Word        ' shell for PAUSE


' =========================================================================
 PROGRAM Start
' =========================================================================

Start:
 PLP_A = %0000
 TRIS_C = %1100_0000                           ' make RC.0 .. RC.5 outputs


Main:
 Leds = IsOff
 dbTimer = 0

Check_Trigger:
 PAUSE 1
 INC dbTimer
 IF Trigger = IsOff THEN Main
 IF dbTimer < 100 THEN Check_Trigger

Zip_It:
 FOR channel = 0 TO 4
   Leds = 1 << channel
   DELAY_MS 100
 NEXT
 FOR channel = 5 TO 1 STEP -1
   Leds = 1 << channel
   DELAY_MS 100
 NEXT

 IF Trigger = IsOn THEN Zip_It

 ' finish last LED

 Leds = %00000001
 DELAY_MS 100

 GOTO Main


' -------------------------------------------------------------------------
' Subroutine / Function / Task Code
' -------------------------------------------------------------------------

SUB DELAY_MS
 PAUSE __wparam12
 ENDSUB

' -------------------------------------------------------------------------


' =========================================================================
' User Data
' =========================================================================


2. VMUSIC.  Do I think you're nuts for wanting to use it?  Yes.

3. Your project.  While it can be done the SX is not nearly as easy to program as the BASIC Stamp -- life can get tough with the SX (which is why I'm glad we're moving to the Propeller for our new products).  SX/B helps -- a lot -- but you still need to understand the SX in order to get the most from it.  The up-side is that you can use very fast baud rates with the SX and that can help.


Again, in the future please post just one question/topic per thread with a subject line that others can use to fins what they're looking for.  The idea behind these forums is to make helpful information public (email isn't) and easy to search (which only happens with good subject lines and single-topic threads).





Jon McPhalen
EFX-TEK Hollywood Office