SV: [basicstamps] big Brother and big Sister pls help me.( very Long)
Archiver
Posts: 46,084
Greetings!
I've only taken a quick peek at your program, but...
My suggestions are:
1. are all variables in use at the same time?
Maybe you could 'reuse' some of the variable space for other
tasks.
2. Splitting it into several banks. This may or may not reduce the
variable usage.
If so, remember that when you RUN another bank, the 'exit point'
from the old Program is lost. There's no 'RETURN to previous program',
and variable definitions must be exactly the same for both programs if
variable passing is to work. (Better to use Scratchpad RAM for
transferring data between programs)
To make this work, bank 0 must be a 'general loop' program, capable of
handling re-entry.
(possibly using a reserved byte in scratchpad.)
The next slots can then contain routines for LCD updates, communications
and so on.
There's both excellent Nuts&Volts articles and docs on the Parallax
website explaining this in detail.
But in short,
Bank0
Read scratchpad Byte to decide what to do.
= 0 >> Gosub init.
= 'OK' goto loop:
= ??? Do other things
Loop:
Need to update LCD? > gosub LCD_Update
End loop
LCD_Update:
Prepare strings(in scratchpad)
Set statusbyte to 'update lcd'
RUN 1
Bank1
IF statusbyte = 'updateLCD' gosub update
IF statusbyte = 'init LCD' gosub initlcd
IF statusbyte = 'clear LCD' gosub clslcd
set statusbyte to 'OK' or 'LCD OK' (or whatever suits the
program flow)
RUN 0
Anyway, it can be a hassle to restructure the program, so try to plan it
by looking at what information is needed where and what belongs
together.
:-)
Trygve
Opprinnelig melding
Fra: lim EngTat [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wZ79UF_rYxfjJk4b-6ckIqgWKyxsC1UTYREd1m23-JbL41RvlXbRjZaq-p1bhZItAjGIhLosD5gKZY8m]benzlim83@y...[/url
Sendt: 7. desember 2003 17:30
Til: basicstamps@yahoogroups.com; sswanson@p...;
tracy@e...
Emne: [noparse][[/noparse]basicstamps] big Brother and big Sister pls help me.( very Long)
Hi All,
I'm a student from singapore currently doing my project on "SMS control
and Monitoring" So far i think l'm doing quite well as i'm very new to
STAMP. i'm able to sms and receive a reply to my handphone with the
temperature reading.
I have brought : BS2p40 starter kit
siemens modem
DS1624 (temperature sensor)
Amulet LCD.
As i had use up all 26 variable, l'm now in a lost.....
i did some research and i got three methods here.
- use multi-banking ( i don't think i can use this)
- use scratchpad RAM (will this help?)
- EEPROM (24LC32) ( i dun noe how to use it)
i have attach the source code below pls advise me.
i need to reduce the variable for other use.
'{$STAMP BS2p}
'pin0 and pin 3
Siemens modem
'pin 8 and pin 9
DS 1624
'pin 16
Amulet LCD
'============Setting for Siemens modem=================
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
SERIN 3, 18447, [noparse][[/noparse]WAIT("OK")] 'wait for text mode ok reply
'===========Declaring Variable=======================
Number_Str VAR Byte(3) 'for temperature reading
SerString VAR Byte(5) 'for password
MessageAddress VAR Byte(9) 'address to reply SMS
Value1 VAR Byte 'convert to Decimal1
Value2 VAR Byte 'convert to Decimal2
'============temperature variable==============
ADR VAR Byte
DAT VAR Byte
OUT CON 1
IN CON 0
SDA_OUT VAR OUT8
SCL_OUT VAR OUT9
SDA_IN VAR IN8
SDA_DIR VAR DIR8
SCL_DIR VAR DIR9
T VAR Word
O_BYTE VAR Byte
I_BYTE VAR Byte
N VAR Byte
I've only taken a quick peek at your program, but...
My suggestions are:
1. are all variables in use at the same time?
Maybe you could 'reuse' some of the variable space for other
tasks.
2. Splitting it into several banks. This may or may not reduce the
variable usage.
If so, remember that when you RUN another bank, the 'exit point'
from the old Program is lost. There's no 'RETURN to previous program',
and variable definitions must be exactly the same for both programs if
variable passing is to work. (Better to use Scratchpad RAM for
transferring data between programs)
To make this work, bank 0 must be a 'general loop' program, capable of
handling re-entry.
(possibly using a reserved byte in scratchpad.)
The next slots can then contain routines for LCD updates, communications
and so on.
There's both excellent Nuts&Volts articles and docs on the Parallax
website explaining this in detail.
But in short,
Bank0
Read scratchpad Byte to decide what to do.
= 0 >> Gosub init.
= 'OK' goto loop:
= ??? Do other things
Loop:
Need to update LCD? > gosub LCD_Update
End loop
LCD_Update:
Prepare strings(in scratchpad)
Set statusbyte to 'update lcd'
RUN 1
Bank1
IF statusbyte = 'updateLCD' gosub update
IF statusbyte = 'init LCD' gosub initlcd
IF statusbyte = 'clear LCD' gosub clslcd
set statusbyte to 'OK' or 'LCD OK' (or whatever suits the
program flow)
RUN 0
Anyway, it can be a hassle to restructure the program, so try to plan it
by looking at what information is needed where and what belongs
together.
:-)
Trygve
Opprinnelig melding
Fra: lim EngTat [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wZ79UF_rYxfjJk4b-6ckIqgWKyxsC1UTYREd1m23-JbL41RvlXbRjZaq-p1bhZItAjGIhLosD5gKZY8m]benzlim83@y...[/url
Sendt: 7. desember 2003 17:30
Til: basicstamps@yahoogroups.com; sswanson@p...;
tracy@e...
Emne: [noparse][[/noparse]basicstamps] big Brother and big Sister pls help me.( very Long)
Hi All,
I'm a student from singapore currently doing my project on "SMS control
and Monitoring" So far i think l'm doing quite well as i'm very new to
STAMP. i'm able to sms and receive a reply to my handphone with the
temperature reading.
I have brought : BS2p40 starter kit
siemens modem
DS1624 (temperature sensor)
Amulet LCD.
As i had use up all 26 variable, l'm now in a lost.....
i did some research and i got three methods here.
- use multi-banking ( i don't think i can use this)
- use scratchpad RAM (will this help?)
- EEPROM (24LC32) ( i dun noe how to use it)
i have attach the source code below pls advise me.
i need to reduce the variable for other use.
'{$STAMP BS2p}
'pin0 and pin 3
Siemens modem
'pin 8 and pin 9
DS 1624
'pin 16
Amulet LCD
'============Setting for Siemens modem=================
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
SERIN 3, 18447, [noparse][[/noparse]WAIT("OK")] 'wait for text mode ok reply
'===========Declaring Variable=======================
Number_Str VAR Byte(3) 'for temperature reading
SerString VAR Byte(5) 'for password
MessageAddress VAR Byte(9) 'address to reply SMS
Value1 VAR Byte 'convert to Decimal1
Value2 VAR Byte 'convert to Decimal2
'============temperature variable==============
ADR VAR Byte
DAT VAR Byte
OUT CON 1
IN CON 0
SDA_OUT VAR OUT8
SCL_OUT VAR OUT9
SDA_IN VAR IN8
SDA_DIR VAR DIR8
SCL_DIR VAR DIR9
T VAR Word
O_BYTE VAR Byte
I_BYTE VAR Byte
N VAR Byte