Shop OBEX P1 Docs P2 Docs Learn Events
More about the Prop Backpack and work — Parallax Forums

More about the Prop Backpack and work

Buck RogersBuck Rogers Posts: 2,185
edited 2014-03-10 20:41 in General Discussion
Hello!
Well as everyone by now knows my Prop backpack arrived last week, and I spent the weekend getting to know it better. After sending the examples to the big screen here, I then tried out the small screen I have from Adafruit. which is their item 910. Indeed the screen size variable does make a difference. Now I decided to try out my efforts at pasting together a first time effort for this contraption. So far it does do what was expected.
' =========================================================================
'
'   File...... screentest1.bs2
'   Purpose... screener
'   Author.... GCL -- Jedi Knight Computers
'   E-mail.... gregg@levine.name
'   Started... 10 Mar 2014
'   Updated... 10 Mar 2014
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


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


' This program outputs video to an NTSC color monitor via a Propeller
' Backpack module and demonstrates the various features of the video driver.




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


io     PIN 15           ' Serial I/O pin for Propeller Backpack.


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


' Baudrate definitions. Serial I/O must be open-drain. The Propeller Backpack
' includes a pullup internally.


#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    baud    CON  84 + 32768
  #CASE BS2SX, BS2P
    baud    CON  240 + 32768
  #CASE BS2PX
    baud    CON  396 + 32768
#ENDSELECT


' The following is a table of "command" constants for the Propeller Backpack
' that can be copied to other programs. The ones that are commented are already
' defined by the BASIC Stamp Editor and perform the same functions as they
' would in a DEBUG screen.


'CLS           CON $00  'clear screen
'HOME          CON $01  'home
'CRSRXY        CON $02  'set X, Y position (X, Y follow)
'CRSRLF        CON $03  'cursor left
'CRSRRT        CON $04  'cursor right
'CRSRUP        CON $05  'cursor up
'CRSRDN        CON $06  'cursor dn
 USECLR        CON $07  'use color C (C follows)
 BS            CON $08  'backspace
'TAB           CON $09  'tab (8 spaces per)
'LF            CON $0A  'linefeed
'CLREOL        CON $0B  'clear to end of line
'CLRDN         CON $0C  'clear down (to end of window)
'CR            CON $0D  'return
'CRSRX         CON $0E  'set X position (X follows)
'CRSRY         CON $0F  'set Y position (Y follows)
 DEFWIN        CON $10  'define window  W (W, Left, Top, nCols, nRows follow)
 USEWIN        CON $11  'use window W (W follows)
 DEFCLR        CON $12  'define color C (C, FG, BG follow)
 SCRLLF        CON $13  'scroll window left
 SCRLRT        CON $14  'scroll window right
 SCRLUP        CON $15  'scroll window up
 SCRLDN        CON $16  'scroll window down
 CHGCLR        CON $17  'change all colors in window to C (C follows)
 SCRSIZ        CON $1D  'set screen size (Rows, Columns follow)
 CLRW          CON $1E  'same as CLR, but can be used in strings.
 ESC           CON $1F  'escape next character C (i.e. print as-is) (C follows)
 ZERO          CON $FF  'can be used for 0, which is not allowed in strings, for command arguments


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


i             VAR Word
char          VAR Byte


'-------[ String Data ]--------------------------------------------------------


'DATA  "Scrolling is handy for creating things like marquees.....", 0


'-------[ Program starts here. ]-----------------------------------------------


LOW io            'Reset the Propeller Backpack
PAUSE 500
INPUT io


PAUSE 2000        'Wait for it to come out of reset.


SEROUT io, baud, [DEFWIN, 1, 20, 2, 7, 9, USEWIN, 1, CHGCLR, 12]
FOR W0 = 1000 TO 1050
SEROUT io, baud, [" ", DEC W0, CR]
PAUSE 220
NEXT


I imagine Phil you will recognize the format of the header reference and the variables, and of course the fragment.

I decided since I rarely remember to document my own programming, I figured I'd better start off with this one. The fragment does what I thought it would do, it displays there the numbers chosen. I'm still playing with the screen sizing routines as this small screen doesn't, ah, scale properly.

More information. Whilst trying to further test that example, I promptly got a complaint. The IDE insisted that it couldn't find the Stamp. That usually indicates a low voltage condition. Rather then continuing to run things on a rotating series of classic 9v batteries I decided to track down a wall wart to charge the battery box the board is standing on. The box is this guy, http://www.parallax.com/product/28989 and of course it arrived here, earlier in the year fully charged or so it seemed. Which was 1/21/2014. It seems I've reached the predictable limits for such cells as those.

I'm going to let the thing charge for an overnight period......
Sign In or Register to comment.