November 23, 2024, 10:04:40 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Will this work on a PROP 1 as it dose on a PROP 2 or am I way off

Started by samsam, July 07, 2009, 07:53:42 PM

Previous topic - Next topic

samsam

' {$STAMP BS1}
' {$PBASIC 1.0}


INPUT 1

SYMBOL  cntr = B1

main:
cntr =  cntr + 1 * PIN1

IF  cntr = 100 THEN   Exit           ' or any other routine that you want

Exit:

' Your own routine

RETURN


' {$STAMP BS2}
' {$PBASIC 2.5}


chg             PIN     1

cntr            VAR     Byte            ' Loop Counter


do
cntr = cntr + 1 * Chg
IF (cntr = 100) THEN EXIT
loop
RETURN


Sam

I Want  Thank You for All Of Your Time And Help

...............In Helping Getting Thing To Work........

JonnyMac

You're not far off -- here's my standard template; I recommend you adopt it as a starting point for your Prop-1 programs:

' =========================================================================
'
'   File......
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Sio     :: Serial IO to EFX-TEK accessories (RC-4, FC-4, etc.)
'            -- clip pin 1 of ULN2803 or replace with ULN2003
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = B2


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00111111                              ' set output pins


' -----[ Program Code ]----------------------------------------------------

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  ' prop code here

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------


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


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


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


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

One place where you are off is the use of RETURN without a GOSUB -- if you do this you can cause the program to crash.  Note that in my template I use GOTO to get back to the beginning of the Main loop.
Jon McPhalen
EFX-TEK Hollywood Office

samsam

I  have not  use a BS1 before but I do have one

Some time soon I will buy a Prop1 as well and use it in a Project

Thanks for the info and the template

 
Sam

I Want  Thank You for All Of Your Time And Help

...............In Helping Getting Thing To Work........