BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 1:04 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Atom Pro 40 Eeprom works different then Atom 40 Eeprom..??
PostPosted: Sun Sep 12, 2010 10:10 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi
Using the “writedm” command, I get strange results by
using the second linen of my code.
If I don’t use the second line,
the terminal window shows the expected result:
..............................................
ABCDEFGHIJKLMNOPQRSTUVWXYZ
test2.
.................................................
But including the second line, without changing the read-loop
the terminal window shows :
...............................................
ghijklmnopqrstuvwxyzUVWXYZ
test2
................................................

It looks like it is reading some old Values…?
But no more starting at the Address = “0”
or overwrite the first Adresses...?

I can’t see what is wrong…..?
Need some tip please

In the Atom 40 the “Data” command was working fine.
I like to transfer my Atom40 Program to the Atom Pro 40,
but stuck on the Eeprom problem.

Heinz Germany

Code:
writedm 0,  ["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
'    writedm 26, ["abcdefghijklmnopqrstuvwxyz"]
writedm 5000, ["test2"]
 
x         var  word
zeichen   var   long
cr      con   13
        
   start:
for x = 0 to 25
read x, zeichen
serout s_out,i9600,[zeichen]
next

serout s_out,i9600,[cr]

for x = 5000 to 5004
read x, zeichen
serout s_out,i9600,[zeichen]
next

serout s_out,i9600,[cr]
pause 1000
goto start


Top
 Profile  
 
 Post subject: Eeprom.. wrong addressing...defect ?
PostPosted: Tue Sep 14, 2010 11:17 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi,
before I send back the Atom I would like to make sure that I don’t misunderstand something…
If I write (writedm) some Text into the eeprom and read it back, it looks to me that the text is on the wrong address…?

With my test code the terminal shows: (one line)

ABCDEFGHIJKLMNOPQRSTUVWXYZ******efghijklmnopqrstuvwxyz******abcd41516171819*****1234567891012131***************

but, for example, the “abcd” is not on its place.
And the numbers too are not in order
How is it possible ?
Do I do something wrong, or is the addressing of the eeprom bad working ?
Would be nice to clarify it. Heinz
:?: :?:
Code:
x             var long
zeichen    var    long
cr            con    13

for x = 0 to 300
writedm x, ["*"]    'Write to eeprom 300 ²*²
next

  writedm 0,  ["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]    'overwrite the "*"
  writedm 60, ["abcdefghijklmnopqrstuvwxyz"]
  writedm 80, ["123456789101213141516171819"]

    start:
for x =0 to 110
read x,zeichen
serout s_out,i9600,[zeichen]
next
serout s_out,i9600,[cr]
goto start


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Tue Sep 14, 2010 11:50 am 
Offline
Master

Joined: Mon Jul 17, 2000 10:00 am
Posts: 155
Looking into it now. I will get back to you with result.

_________________
Servo Controller - ARC32!


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Tue Sep 14, 2010 1:30 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hello, Heinz. I tried your code against a BAP40 on a BasicATOM Lab Board. I got the same results. It occured to me the addresses may be interpreted as hex values rather than decimal, but then the starting addresses would have been 0, 96 and 192 decimal, so much farther apart.
I have no answer to your situation. Looks like we're waitinng on BasicMicro's final response.
Good luck.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Tue Sep 14, 2010 2:51 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Heinz, check out my app note on I2C EEPROMs:
http://forums.basicmicro.net/atomnano-f485/app-note-using-a-64k-i2c-eeprom-with-an-atom-microprocessor-t9235.html
This has been tested against all Atom types. The EEPROM on a BAP28 and BAP40 is an I2C part if I remember correctly. It is connected to certain pins, like P8 and P9, not sure exactly.
Anyways, it occurs to me that EEPROMs usually operate with fixed page sizes. You may be limited to 16 bytes at a time, then you have to wait some set time to allow the part to actually write everything you just put in the buffer. I noticed things seem to be happening on 32 byte boundaries in your screen dump. Try writing everything 16 bytes at a time, then do a 100 ms PAUSE between these writes. You may need more time, just experiment. Or write one byte at a time.
Take care.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Wed Sep 15, 2010 6:02 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi kenjj,
thanks for looking after my code, my problem.
I tried different addressing…but don’ see how the Atom handles it.
I tryet also to write 32 letter-blocks including pause…
But when I pase the 32adress it mix up.

In this code the “8” should be the last number, but overwrite the first Letter, the “A”
Terminal:
8BCDEFGH**abcdefgh*******1234567*******************

I can not see any mistakes of mine…?? or misunderstanding..??

In the Manual I find this:

Syntax
write address,[{modifi ers}data1,...,{modifi ers}data2]
• Address - memory location to start the write at. Can be an expression, constant or variable.

**************************************

writedm 0,[“Hello world”]
index var byte
string var byte(11)
readdm index,[str string\11]
serout s_out,i9600,[str string\11]
end

but I find nothing about addressing.

……could it be a bug, or bad eeppm….?

wish you a good time Heinz

Code:
x         var long
zeichen      var   long
cr         con   13

for x = 0 to 300
writedm x, ["*"]   'Write to eeprom 300 ²*²
next

  writedm 0,  ["ABCDEFGH"]    'overwrite the "*"
  Pause 500
  writedm 10, ["abcdefgh"]
   Pause 500
  writedm 25, ["12345678"]   'writedm 24, ["12345678"]
   Pause 500

for x =0 to 50
read x,zeichen
serout s_out,i9600,[zeichen]
next
serout s_out,i9600,[cr]
   end

'     Terminal shows:
'     8BCDEFGH**abcdefgh*******1234567*******************



Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Wed Sep 15, 2010 8:37 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
The problem you are seeing is because of the paging of the eeprom chip. All i2c eeproms have a buffer size but those buffers are ALSO on a boundry. So you can write 32bytes at once with a 24c32(like whats on the AtomPro modules). However those 32 bytes have to be on a 32byte boundry. So you can't write 32 bytes starting at address 8. If you do you will write 24 bytes from 8 to 31 and then 8 more bytes from 0 to 7.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom
PostPosted: Thu Sep 16, 2010 3:11 pm 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi Natan
Thanks for your good and clear explanations.
I got it. :idea:
…………………………....
Tothe Basic-Atom-Team:
.
In the Atom 40 with the DATA command was no 32 byte restriction.
How to expect a difference to the Atom Pro ??? How to know this ???
.
It would be HELPFULL for BACIC-PROGRAMMERS to find in the manual under the WRITEDM command some clarifications about this 32 byte writing restriction. It would save your costumers time and it would not stress there patience. :x
regards Heinz


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Thu Sep 16, 2010 6:56 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hello, Heinz.
So, did you write code that works for you? I reworked my code and got it to successfully write on 32 byte boundaries. I use HEX values for the start addresses: 0, $20 and $40, because $20 = 32 decimal. I have my program print out the results in three lines of 32 characters.
As for not mentioning all this in the manual: They wrote a syntax manual. They largely only discuss the parts of the command and a give a brief description of what each part does. Detailed explanations get saved for forum discussions like this.

Years ago, Jack Smith wrote a wonderfully detailed manual for the BMicro's MicroBasic Pro 5211, their standalone compiler/IDE. He provided hundreds of pages of pictures, charts, illustrations and schematics. It even covered the bugs he found, giving workarounds for most of them. Just about everything he covered applied to the basicATOM parts as well. The book cost more than $50 on Amazon, a little less at other places. The explanations would help anyone interested in most PIC parts for the time, forget BMicro.
Five years later the book is largely obsolete for BMicro parts. The PICs are different internally, the commands have changed in a lot of ways, timings are revamped... and Jack Smith isn't offering an updated book. Neither is BasicMicro. Books of that complexity must be a monster to maintain. Thus, a simple syntax manual isn't going into exquisite detail, verstehen?

That's why there is a forum. Feel free to stop by anytime and ask your questions.
Later.
Code:
x          var long
zeichen    var long
cr         con 13  ; value for terminal's new line

PAUSE 500  ; Time for Pro to initialize

; The first value (0) in the next routine only works on Studio's terminal
SEROUT s_out, i9600, [0, 7, "Starting...", cr] ; clears screen, beeps, does new line
PAUSE 500 ; Slight delay so user can see start up message

for x = 0 to 300
writedm x, ["*"]    'Write to eeprom 300 ²*²
next

  writedm 0,  ["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]  ; first buffer write
 
  writedm $20, ["abcdefghijklmnopqrstuvwxyz"] ; 2nd buffer write, was 60
 
  writedm $40, ["123456789101213141516171819"]  ; 3rd buffer write, was 80
 
    start:
for x =0 to 95  ; reads out 96 characters
read x,zeichen
serout s_out,i9600,[zeichen]

; This routine writes out 32 characters (one buffer) per line
IF x <> 0 AND (x+1) // $20 = 0 then
SEROUT s_out, i9600, [cr]  ; does a new line
ENDIF

next
SEROUT s_out, i9600, [cr, cr]
goto start

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Fri Sep 17, 2010 9:42 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Just a clarification.

The Atom40 has internall eeprom that always writes single bytes at a time. This means even when using the writedm command it still internally only writes 1 byte at a time which is pretty slow. The AtomPro40 has an external i2c eeprom which writes data at upto 32bytes at a time. The WriteDM command tries to write as many bytes as you give it on the AtomPro so if you give it more than 32 to write at once it will fail. Also if you give it more bytes to write starting at an offset other than a multipl of 32 it will fail. For example, if you start at address 8 and try to write 32 bytes, the first 24 bytes will be written correctly, but the last 8 will be written to address locations 0 to 7. The reason this is so is because we allow you to use the i2c eeprom write buffer. We could change it so that internnally it only writes one byte at a time but that would be upto 32 times slower than the current system.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Sun Sep 19, 2010 3:43 pm 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi Natha,
after your first explanations I played with the writedm-command and different address constellations, and then it was easy to arrange my old text in 32 byte blocks. So all my old read- commands worked like before without changing a address in the read-comand.
After the writedm- command I did not need a pause.
Immediately the next writedm-command (32byte) is accepted..???

Hi kenjj,
Also your code is clear to understand for me now..!
Also Nathan’s explaining, that writing byte by byte to the eeprom is much slower, is clear.
Thanks for all your work.

kenjj,
the viewpoint of a simple BASIC-programmer:
.
Much Basic-Language-Controller are offered on the market, because of there easy way of using and programming.
I joy and use this controller because I believe this offering.
I expect no problems while using basic-commands according to the explanation in the manual....
And if it is not working I have to think about a defect.
.
The writedm-command:
.
I have no chance to use the writedm-command by reading the manual….
.
Now, after your explaining, it is clear and easy, but it takes much time, much research for only a simple information like it could be:
.
“The addresses have to be on a 32byte boundry.”
.
I don’t speak about a monster explanation or a big book.....
......................................
To have a forum like this one is very fine...!!
But to stop work, write to the forum, wait for answer,
is not very effective.
.
I would be happy to have a manual, witch give me the ability to do my work continuously.
.
Can you imagine,
how much time, experiments and patience it needs to find some simple information’s?
And how helpful the mostly perfect explanation is ?? (Manual) ??
...................
Anyway
......................
have a nice time Heinz


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Sun Sep 19, 2010 7:57 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
It's the common dilemna of document writers everywhere: What constitutes ENOUGH information? At what point does the reader bog down in too much data?

I have visited several PIC BASIC suppliers, and everyone one of them has complete, better documentation than BMicro at the moment. And everyone of them falls down in some other area, and if they have a forum, there are numerous posts about their prime failings.
Even Parallax, with their undeniable excellence in documentation, produces a module (BasicStamp) that is clearly lacking in the features available from every other PIC supplier. So, you get to learn how to use the RCTIME command with an RC circuit to fake an ADC input in great detail. You want that and all the hardware considerations involved, or the simpler
ADIN P#, variable_name?

I hate to proselytize, but NO ONE offeres a complete package to use a PIC for cheap, fully documented, readily available, with a BASIC this easy and powerful. If they did, I would have left here a loonnng time ago. ;)
And the documentation part gets better here all the time. Not real fast, mind you, but they're busy answering questions here and in tech support mails, while running a business.
Just keep sending those questions in...

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Mon Sep 20, 2010 12:18 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
The writedm command on the AtomPro calls the i2c commands to handle the writes. It also follows the rules as far as waiting for the write to finish so you don't need to put a delay in after the writedm command. Same goes for i2c commands(unless you use the timeout and error label).

The new manual will correct all the documentation issues you have. It is very close to being ready and you can start using it now. See the manual section of the forums for the latest release.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Fri Oct 01, 2010 4:46 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi Kenjj,
Yes, the hardware futures of the Atoms are great.
But several times I got crazy about the documentation.
I use the Atom und the Basic Stamp for years.
The Atom’s Hardware with a documentations like for the Basic Stamp would be perfect. But since years the Atoms documentations are rather limited.


hi Nathan
I already tried the writedm Command without the Pause between and it worked fine. Thanks

I updated Studio 1.0.0.35 to studio 2.0.0.0
I get an error massage using the ”old” pulsin command
Is the pulsin command changed ??
.


Top
 Profile  
 
 Post subject: Re: Atom Pro 40 Eeprom works different then Atom 40 Eeprom.
PostPosted: Fri Oct 01, 2010 8:29 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Post me your pulsin code and the error message you get. It may be an error from the line before it. Pulsin wasn't changed from .35 to 2.0so I'm not sure what it could be without more info.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO