EEPROM to store SEROUT data?
Falcon
Posts: 191
My Home Monitor project is exploding with SEROUT commands that are starting to put a squeeze on my onboard memory space. I have 16 sensors that are read, and based on the condition of each, the following peripheral devices are used:
4x20 Serial LCD displays all condition changes
SEROUT LCDPin, LCDBaud, [LcdCLS, Line0, "GARAGE DR CLOSED"]
DEBUG displays all condition changes
DEBUG "GARAGE DR CLOSED "
PINK Web Server (to update variables) updated for all condition changes
SEROUT TX, Baud, ["!NB0W01:100", CLS]
SEROUT TX, PINKBaud, ["!NB0W21:CLOSED", CLS, ",", "!NB0W20:", CLS]
SEROUT TX, PINKBaud, ["!NB0W20:", CLS]
SEROUT TX, PINKBaud, ["!NB0W60:", HEX2 month, "/", HEX2 date, "/", HEX2 year," ", HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, CLS]
PINK Web Server (to send email) sends email for critical condition changes
SEROUT TX, PINKBaud, ["!NB0SM",CLS, ,,"!NB0WES:GARAGE DOOR OPEN", , , CLS, , ,"!NB0ST"]
SERIN RX, PINKBaud, 1000, TIMEOUT, [nbvar]
The SEROUT commands to the PINK are text statements surrounded by quotation marks and are separated using delimiting. Can these text statements in the above SEROUT commands be stored in EEPROM (either onboard a BS2px or on an external 24LC128) and then retrieved using the READ command and placed in the SEROUT statement only when required? Would they then only need to be separated by commas?
falcon
4x20 Serial LCD displays all condition changes
SEROUT LCDPin, LCDBaud, [LcdCLS, Line0, "GARAGE DR CLOSED"]
DEBUG displays all condition changes
DEBUG "GARAGE DR CLOSED "
PINK Web Server (to update variables) updated for all condition changes
SEROUT TX, Baud, ["!NB0W01:100", CLS]
SEROUT TX, PINKBaud, ["!NB0W21:CLOSED", CLS, ",", "!NB0W20:", CLS]
SEROUT TX, PINKBaud, ["!NB0W20:", CLS]
SEROUT TX, PINKBaud, ["!NB0W60:", HEX2 month, "/", HEX2 date, "/", HEX2 year," ", HEX2 hrs, ":", HEX2 mins, ":", HEX2 secs, CLS]
PINK Web Server (to send email) sends email for critical condition changes
SEROUT TX, PINKBaud, ["!NB0SM",CLS, ,,"!NB0WES:GARAGE DOOR OPEN", , , CLS, , ,"!NB0ST"]
SERIN RX, PINKBaud, 1000, TIMEOUT, [nbvar]
The SEROUT commands to the PINK are text statements surrounded by quotation marks and are separated using delimiting. Can these text statements in the above SEROUT commands be stored in EEPROM (either onboard a BS2px or on an external 24LC128) and then retrieved using the READ command and placed in the SEROUT statement only when required? Would they then only need to be separated by commas?
falcon
Comments
I'll give that a go.
falcon
1. So far I have this code working to write a text string into the onboard EEPROM and read it back
I was looking at some code written by Xanatos where he used the following DATA statement format. He was writing 30+ strings to EEPROM
I saw the following code in the BSM to specify the EEPROM location to write a variable using the "@" symbol:
What is the difference between using the 00 after DATA, and using the "@" symbol? Does it have to do with multiple READ statements? Since I'm using
SYMBOLS for each text string I guess I don't have to use the "@" symbol to specify the location. Is that correct?
2. Do I need to keep track of the EEPROM location for each of the statements for any reason? Or will the SYMBOL be all I need know?
3. How would I use the "player routine" to write a line of code like the following with multiple text strings in it?
I suppose I would start out by placing the individual strings into DATA statements like this:
How would I then use the player routine to get those two strings into the SEROUT statement shown above?
I will ultimately store all of my text strings on a 24LC16B connected to a BS2PX24 using the I2C protocol. Will the same general approach apply?
I appreciate any and all replies. I'm sure I'll have more questions but I want to start with this small snippet and understand it before I just throw it into a bigger program.
falcon
I then though I could just treat the entire contents inside the brackets as one long text string, and send it to the EEPROM. The problem with that is the DATA statements require the data to be inside a set of quotation marks(""), AND, in this case, the PINK module also requires the data to be inside a set of quotation marks. So the following line of code will not compile with the two quotation marks at the beginning.
[code]
PINK0 DATA ""!NB0W21:CLOSED", CLS, ",", "!NB0W20:", CLS"
I did, however, answer my own question 1. The 00 before(and the CR after) the data is required by the V-Stamp module. So I don't need to worry with that until I start integrating my V-Stamp.
Anyone know a work-around?
falcon
It is possible to "wear out" an EEPROM location by writing to it continuously. I have heard life estimates of a half-million times to several million write cycles. Not normally a problem unless you inadvertently get into an endless loop (check that GOTO thread!) that keeps writing to the same location a thousand times each second.
I read that thread earlier today while researching but I don't see that going on here. Did you mean that as a general warning, or were you refering to a specific bit of my code?
falcon
I decided to try using ASCII characters to write the entire string to EEPROM, and then READ it out and use it to update the PINK. I came up with this: I'm getting the following on the DEBUG screen:
"!NB0W22:CLOSED",CLS
...but the PINK variable 22 is not updating.
I know the following line of code works because the PINK updates fine when this line is used as is (without being sent to, and read from EEPROM).
My immediate goal is to save this, and many other, long text strings to EEPROM to free up some program space. Long term goal is to write these strings to an external EEPROM.
falcon
I switched to trying to use the external EEPROM 24LC16B with the following code to write a simple phrase.
Can anyone help get this snippet working so I can keep this project moving?
Thanks,
falcon
SEROUT TX, PINKBaud, [char] '<-- this goes inside the String_out loop
In the newest post, what is it that doesn't work? What happens?
As written, the DEBUG screen returns the following (without the text in the parenthesis):
ÿ
ÿ
ÿ
ÿ
ÿ (this character is displayed ~ 60 times)
€ (I then get this character one time)
ÿ (then this character is displayed another ~60 times.
In the extended ASCII table, the character ÿ is a DEC159 or HEX 9F, and the € is DEC 128 or HEX 80
I do not get any characters on the LCD screen.
I'm using the I2CIN circuit from the BS Syntax and Reference Manual page 219.
The LCD works fine when I load a different program that uses it
falcon
I put that SEROUT statement inside the String_out loop and it is now writing to the PINK.
I also had to remove the ",CLS part of the DATA statement because that was being written to the PINK too.
All is now good regarding writing from the BS2px EEPROM to the PINK.
Now, to get this to the external 24LC16B...
falcon