May 05, 2024, 10:17:13 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


will it hurt prop 1

Started by tj, October 10, 2007, 05:53:00 PM

Previous topic - Next topic

tj

jon i spoke to you earlier in the week, i ordered the starter kit yesterday. Is it possible to mess it up by writng a bad code, or will it just not do anything? I look in the programing basics and think i understand, then look here and get overwhelmed. Is there somewhere i can look to see simple codes, to try just to see how/what they do, when i add or change something.
Also, do you type all of what is on your codes every time, ex. pbasic, stamp1, constants, main, variables, so on, or is it a template?

JonnyMac

You can't hurt the controller writing bad code -- unless that "bad" code is directing pins that are supposed to be inputs to become outputs; that can present a problem.  We have some protections on the board, but they won't cover everything.  Just be careful in your code, and if you're unsure, post it (and the connections) here for review.
Jon McPhalen
EFX-TEK Hollywood Office

tj

ok, thanks, do you type in all the dashes and all the other stuff or just the code itself?

JonnyMac

I only typed those dashes once; then I save them into a template that my editor loads up every time do a File >> New operation.  You can find that template in the Library forum under Prop-1: http://www.efx-tek.com/php/smf/index.php?topic=4.0
Jon McPhalen
EFX-TEK Hollywood Office

tj

ok,i see it, i try to read first then ask ? been reading on here all week, so much to learn.

tj

i recieved my prop 1. im trying to use the prop trainer, when i hit run it downloded and it said tokenize/download complete
when i hit the trigger on trainer i get nothing did i not do something?

program

  ' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


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


' -----[ I/O Definitions ]-------------------------------------------------
  SYMBOL  Trigger    = PIN6                'Setup DN
  SYMBOL  LED1       = PIN0
  SYMBOL  LED2       = PIN4

' -----[ Constants ]-------------------------------------------------------
  SYMBOL  IsOn       = 1
  SYMBOL  IsOff      = 0

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




' -----[ Initialization ]--------------------------------------------------
  PAUSE 10000



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

Main:

IF Trigger = IsOff THEN Main             'wait for trigger

LED1 = IsOn

PAUSE 2500

LED2 = IsOn

PAUSE 3000

Led2 = IsOff

PAUSE 1000

Led1 = IsOff

GOTO Main
' -----[ Subroutines ]-----------------------------------------------------




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


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


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


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


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


' -----[ EEPROM Data ]-----------------------------------------------------

JonnyMac

October 12, 2007, 08:20:42 PM #6 Last Edit: October 12, 2007, 08:22:57 PM by JonnyMac
The reason you weren't seeing anything is that you didn't make the output pins outputs -- by default, all I/O is configured as inputs on startup.  There are a couple ways to do this, the easiest (I think) is to configure desired output pins using the DIRS register.  Here's a corrected version of your program:

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


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


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

SYMBOL  Trigger    = PIN6                       ' Setup = DN
SYMBOL  LED2       = PIN4
SYMBOL  LED1       = PIN0


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

SYMBOL  IsOn       = 1
SYMBOL  IsOff      = 0


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


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

Reset:
  DIRS = %00010001                              ' configure output pins
  PAUSE 10000


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

Main:
  IF Trigger = IsOff THEN Main                  ' wait for trigger

  LED1 = IsOn
  PAUSE 2500

  LED2 = IsOn
  PAUSE 3000

  Led2 = IsOff
  PAUSE 1000

  Led1 = IsOff
  GOTO Main


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


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


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


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


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


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


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

tj

ok, i haven't tried it but im sure it will work. I've been looking at that, will that (dirs) work every time, or better yet what it it doing?
what is it causing, i know i can't learn all in a day but i want to understand. the other parts i took from here and there to see what would happen

tj

i think i got it (Dirs), 00010001  the last 1 is pin 0, 5th from last being pin 4?

JonnyMac

Yes.  You can real all about DIRS in the help file; double-click on DIRS in the listing to highlight it and then press the F1 key.
Jon McPhalen
EFX-TEK Hollywood Office