Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp Basic Input Output System — Parallax Forums

Basic Stamp Basic Input Output System

Matthew BurmeisterMatthew Burmeister Posts: 49
edited 2008-05-06 17:37 in BASIC Stamp
I don't know if i would call it a operating system or a BIOS? or it even works! ( I don't have a Basic Stamp... Yet cry.gif )
Maybe it will work.


Specs:
Uses 84% of EEPROM
can make any pin "HIGH" or "LOW" and even "PULSOUT"



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


'BSBIOS
'Copyright 2008 matthew burmeister
'BSBIOS Version 0.01 beta




'BSBIOS sets up here
'==========================================================

command VAR Nib
highpin VAR Nib
lowpin VAR Nib
dummyvar VAR Bit
pulsoutpin VAR Nib
error VAR Nib
pulsouttime VAR Word
pausetime VAR Word


'BSBIOS first message and version command
'==========================================================
version:
DEBUG "version 0.01 beta"
DEBUG "MBBIOS"
DEBUG "Welcome to the BSBIOS"
DEBUG "OR Basic Stamp Basic Input Output System"

'Display the commands the user can use
'==========================================================

commands:
DEBUG "========================================="
DEBUG "1 - Make a pin 'HIGH'"
DEBUG "2 - Make a pin 'LOW'"
DEBUG "3 -'PULSOUT' on a pin"
DEBUG "4 - Display Help"
DEBUG "5 - Clear screen"
DEBUG "6 - Display Version"
DEBUG "7 - Exit BSBIOS"


'Get what command the user wants to execute 
'==========================================================

DEBUGIN command
IF command = "1" THEN GOTO makehigh:
IF command = "2" THEN GOTO makelow:
IF command = "3" THEN GOTO psout:
IF command = "4" THEN GOTO help:
IF command = "6" THEN END
IF command = "5" THEN GOTO clear:
IF command = "7" THEN GOTO version:

DEBUG CLS
error = 2
GOTO errors:


makehigh:
DEBUG CLS
DEBUG "What pin do you want to make 'HIGH'?"
DEBUGIN highpin
IF highpin < 15 THEN error = 1
IF highpin < 15 THEN GOTO errors:
HIGH HIGHpin
DEBUG "the pin has been made 'HIGH'"
GOTO commands:

makelow:
DEBUG CLS
DEBUG "What pin do you want to make 'LOW'?"
DEBUGIN lowpin
IF lowpin < 15 THEN error  = 1
IF lowpin < 15 THEN GOSUB errors:
LOW lowpin
DEBUG "The pin has been made 'LOW'"
GOTO commands:


clear:

'Clear the DEBUG screen
'==========================================================

DEBUG CLS
GOTO commands:

psout:

'Pulse out on given pin
'==========================================================

DEBUG "What pin do you want to PULSOUT on?"
DEBUGIN pulsoutpin
error = 1
IF pulsoutpin < 15 THEN GOTO errors:
DEBUG "Whats is the pulse width?"
DEBUGIN pulsouttime
DEBUG "And how long will the Basic Stamp Pulse Out?"
DEBUGIN pausetime
PULSOUT pulsoutpin, pulsouttime
PAUSE pausetime


help:


DEBUG "MBBIOS HELP"
DEBUG "=========================================="
DEBUG "High - This command makes a pin 'HIGH'"
DEBUG "Low - This command makes a pin 'LOW'"
DEBUG "PULSOUT - This command makes the Stamp Pulse out on a given pin"
DEBUG "Hit enter to return to the menu"
DEBUGIN dummyvar
GOTO commands:


errors:
IF error = 1 THEN DEBUG "BSBIOS ERROR - Check pin number"
IF error = 2 THEN DEBUG "BSBIOS ERROR - Check Command"

'Reset all vars
'==========================================================

error = 0
lowpin = 0
highpin = 0
pulsoutpin = 0
pulsouttime = 0
command = 0

'Asks if the user is ready to go back to the BSBIOS menu
'==========================================================
DEBUG "Hit enter to return to the BSBIOS menu"
DEBUGIN dummyvar
GOTO commands:




Post Edited (Matthew Burmeister) : 5/6/2008 5:43:57 PM GMT
Sign In or Register to comment.