#### Visitor

##### Active Member
It's actually brilliant and very flexible. There is a free version you can try. It's very much like VB6.

Mike.
I absolutely agree, wholeheartedly.

Don't let MrDEB's posts suggest anything negative about Swordfish. It is a fantastic, easy-to-use programming language. The free version of Swordfish is extremely generous, with many people never springing for the paid version (which kind of stinks in my opinion).

#### Pommie

##### Well-Known Member
I absolutely agree, wholeheartedly.
I should have remembered where (and who) I was posting (to).

Mike.

#### be80be

##### Well-Known Member
How could this be hard
Code:
Example Code

// import modules...

include "USART.bas"

include "EEPROM.bas"

include "Convert.bas"

// working variables...

dim Value as byte

dim Str as string

// write data to EEPROM...

EE.Write(0,"EEPROM TEST, Value = ", 123)

USART.SetBaudrate(br19200)

USART.Write(Str, DecToStr(Value), 13, 10)

#### MrDEB

##### Well-Known Member
My logic went south as I failed to insert the present low score into the first sub route. Only writing to the eeprom.
yes it compares prevscore to last score but it is basically in limbo.
the present score is extracted from s=DecToStr(ms/1000)+"."+DecToStr((ms Mod 1000))
this should have currentscore = s
going to do a rewrite and see what happens. Still currious as to where the score of 6553 comes from??

#### MrDEB

##### Well-Known Member
big question-- how to get this to write to the eeprom
s=DecToStr(ms/1000)+"."+DecToStr((ms Mod 1000))
I tried Currentscore = s
Currentscore= s=DecToStr(ms/1000)+"."+DecToStr((ms Mod 1000))
I realize s is a a string but??

#### Visitor

##### Active Member
Here's what I would do, and in fact have done in the past when I wanted to see how this worked.

¤ store a number at an EEPROM address:

EE.Write(1,42) // stores the value 42 at location 1

¤ read the EEPROM value back, into a variable dimensiomed as BYTE:

¤ display the value just read:

LCD.WriteAt (1, 1, DecToStr(x))

Three steps to test if what you saved is what you got back. If it works, build from there. If not, stop and figure out why.

Note that you must use the DecToStr() function. Do your homework and figure out why.

This is a first baby step. Make this work, then figure out how to do this for a WORD instead of a BYTE. Part of this learning process is figuring out WHY you need to use a WORD.

Regarding your last post, save the millisecond number. Do the conversion after you read the number back.

#### MrDEB

##### Well-Known Member
found this weather it is correct?
EE.Write(0,str,s) //this becomes lowest score written to eeprom
I have your instructions printed out and hopefully I can get things sorted out
thanks

#### MrDEB

##### Well-Known Member
well post#46 worked but now what?
trying out small chunks of code but getting nowhere. All I get on the lcd is "
Code:
// working variables...
Dim Value As Byte
Dim Str As String
Dim x As Byte
Dim sw As PORTA.0
Dim ms As Word
Dim s As String
Dim time As Word
Dim LastLOWScore As Byte
Dim Prev_score As Word
Value=45
Prev_score=123
LastLOWScore=34
// working variables...
'Dim Value As Byte
'Dim Str As String
While true
// write data to EEPROM...
'Sub Present_Score()
EE.Write(1,Str,(LastLOWScore))
WriteAt(1,1,LastLOWScore)

#### MrDEB

##### Well-Known Member
oups grabbed this one works
Code:
'Dim Str As String
While true
// write data to EEPROM...
'Sub Present_Score()
EE.Write(1,LastLOWScore)
WriteAt(1,1,dectostr(LastLOWScore))

Wend
the wrong code

#### Visitor

##### Active Member
Baby steps. Will the score or the time ever be larger than 255? What happens if you try saving and recalling 747?

Why?

How so you fix it?

#### MrDEB

##### Well-Known Member
lastlowscore needs to be a WORD
which one? s=DecToStr(ms/1000)+"."+DecToStr((ms Mod 1000)) //players current score
or both?
or can't I just save "s" ???
tried lastlowscore=s dosen't compile

#### Visitor

##### Active Member
Baby steps. Will the score or the time ever be larger than 255? What happens if you try saving and recalling 747?

Why?

How so you fix it?
Learn. Follow the steps and understand what the heck you're doing.

#### MrDEB

##### Well-Known Member
I discovered what the ms equals but now I am getting a contempile error that the special edition se won't allow so many variables.
going through and cleaning out stuff not needed.
so after I get it to compile, just write the value of ms THEN do the conversion?

#### Visitor

##### Active Member
Learn. Follow the steps and understand what the heck you're doing.

#### MrDEB

##### Well-Known Member
May need to make a purchase??

#### Visitor

##### Active Member
Baby steps. Will the score or the time ever be larger than 255? What happens if you try saving and recalling 747?

Why?

How so you fix it?
I thought this was the problem you were stuck on. If you take some effort you may actually learn something.

Additional help from me is contingent on this step.

As far as actually purchasing Swordfish? You probably should since you've been using it for years. The trial edition edition is meant to try it out to decide if it's useful to you. David Barker, the creator of Swordfish, I'm sure would appreciate some remuneration for the work he put into creating Swordfish Basic.

#### MrDEB

##### Well-Known Member
can't believe I went over on variable allocation.
where or does the compiler show variables used?
tried searching but?

#### MrDEB

##### Well-Known Member
Thank you Tumbleweed, your a God send to pic programming.
I purchased the paid version of Swordfish so now I cancontinue.
Will look over my code and make corrections to eeprom writings etc.
Thanks to "visitor" I now realize a better understanding of byte, word etc.

#### Visitor

##### Active Member
Thanks to "visitor" I now realize a better understanding of byte, word etc.
I've tried to help you. Perhaps if you actually do the exercises I suggested in posts #46 and #50, you will gain some understanding. Understanding that carries through to the next time you do the same thing.