Hello there. Why the code i wrote for writing a string in the EEPROM of a 12F675 puts zeros instead of the last chars of the string? (look at the attached picture)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there again. Something has changed in the forum and the image doesn't fit in the window. Right click on it and select show image to see the full one. Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
dim strline as string
strline = "abcdefghijklmopqrstuvwxyz"
firstchar = 0
EPRead streepromaddr, firstchar
for gen_counter = 1 to strline(0)
EPWrite streepromaddr, strline(gen_counter)
streepromaddr++
next
I will try and be back...but....can be different the streepromaddr++ from streepromaddr = streepromaddr + 1? Because except from the if statement I don't see any other difference from my code (btw the if statement is needed, I can not skip it in my application)
Last edit: sfyris 2015-12-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
please post your code that shows the issue. Please post working code. You don't have to post all your code just enough to compile and enable us to understand the root cause.
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What do you mean Anobium? I tryed the code you suggested before but had the same issue. This is a working code allone and nothing more. In the attachment is one file with the asm code and one with hex code
The code below works. When defining string variables the string length defaults to the following rules and the RAM constraints of a specific chip.
· 10 bytes for chips with less than 16 bytes of RAM.
· 20 bytes for chips with 16 to 367 bytes of RAM.
· 40 bytes for devices with more RAM than 367 bytes
· For chips that have less RAM then required RAM to support the strings will be NOT be allocated. -
Sample working code
#chip 12f675
dim strline as string * 26
strline = "abcdefghijklmnopqrstuvwxyz"
streepromaddr = 0
EPRead streepromaddr, firstchar
for gen_counter = 1 to strline(0)
EPWrite streepromaddr, strline(gen_counter)
streepromaddr = streepromaddr + 1
next
Provides from an EEPROM read.
61 62 63 64 65 66 67 68 a b c d e f g h
69 6A 6B 6C 6D 6E 6F 70 i j k l m n o p
71 72 73 74 75 76 77 78 q r s t u v w x
79 7A FF FF FF FF FF FF y z . . . . . .
Last edit: Anobium 2015-12-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well gentlemen once again and after lots of mails, anobium proved how trustworthy is his product (GCGB), how helpful are his advices and what a deep knowledge is hiden in these. Anobium (and Kent) very very thanks for all of your time, keep going giving us your best and I am sure some day somehow you will get good results from this effort. I think the subject was covered and you can lock it now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello there. Why the code i wrote for writing a string in the EEPROM of a 12F675 puts zeros instead of the last chars of the string? (look at the attached picture)

Same problem in 18f2550 :(
Hi there again. Something has changed in the forum and the image doesn't fit in the window. Right click on it and select show image to see the full one. Thank you
@all. This works. Is there an issue?
~~~~~
#chip 12f675
~~~~
Last edit: Anobium 2015-12-05
I will try and be back...but....can be different the streepromaddr++ from streepromaddr = streepromaddr + 1? Because except from the if statement I don't see any other difference from my code (btw the if statement is needed, I can not skip it in my application)
Last edit: sfyris 2015-12-05
Do try. Let us know.
Ok I tryed but not worked. And additionaly I am now with a EEPROM full of unterminated strings :)
please post your code that shows the issue. Please post working code. You don't have to post all your code just enough to compile and enable us to understand the root cause.
Cheers
What do you mean Anobium? I tryed the code you suggested before but had the same issue. This is a working code allone and nothing more. In the attachment is one file with the asm code and one with hex code
Last edit: sfyris 2015-12-06
Sorry, my error.
Can you please post the code you are using? I think my same code has an error. :-( As streepromaddr was not initialised to zero.
Ok tryed with the correction of the initialisation. Now EEPROM is not full of strings but the issue with 0s in the end remains :P
......and here the new asm and hex files
Can you post your gcb source file please?
yes
Please send me a personal message. I will send you the latest build I recommend not posting your email address as a public posting.
Ok got the message. Will check it tomorrow. Thanks for attention Anobium
The code below works. When defining string variables the string length defaults to the following rules and the RAM constraints of a specific chip.
· 10 bytes for chips with less than 16 bytes of RAM.
· 20 bytes for chips with 16 to 367 bytes of RAM.
· 40 bytes for devices with more RAM than 367 bytes
· For chips that have less RAM then required RAM to support the strings will be NOT be allocated. -
Sample working code
Provides from an EEPROM read.
Last edit: Anobium 2015-12-07
Well gentlemen once again and after lots of mails, anobium proved how trustworthy is his product (GCGB), how helpful are his advices and what a deep knowledge is hiden in these. Anobium (and Kent) very very thanks for all of your time, keep going giving us your best and I am sure some day somehow you will get good results from this effort. I think the subject was covered and you can lock it now.
Cheers - but not my product but Hughs'.
Anobium
:) ok sorry Hughs
This answered a question I was going to ask before i asked it. So many thanks form me, as well. And hugs to Hughs, lol!