View previous topic :: View next topic |
Author |
Message |
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 6:53 am Post subject: Create Excel File on SD Card Problem! |
|
|
Hi
i have an MicroSD Card and i can work with it well. i can create an Excel file too. but i want to make hirizontal tab on the my Excel file, but i can't.
i used from below ASCii code in the Config_AVR-DOS file, but all of them make a Vertcal TAB. i ataach my Excel File picture too.
(BASCOM-AVR version : 2.0.7.6 ) _________________ www.mrkelectronic.blogfa.com
Best Regards
Last edited by Ajaxelectronic on Wed Aug 14, 2013 8:48 am; edited 1 time in total |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Wed Aug 14, 2013 8:07 am Post subject: |
|
|
Show me the raw data, open the file with XVI32
Then you can see if there's an ascii(9) or that excel is messing it up. _________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 8:47 am Post subject: |
|
|
thanks Evert
i had a mistake! i used from Print instead of Write!
now i use from Write and it work nice. _________________ www.mrkelectronic.blogfa.com
Best Regards |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 10:34 am Post subject: |
|
|
other problem!
how can i write a var on my favorite Excel Cell?
for example i want to write "100" on C5 Cell Address. or i want to when i open my Excel File again write "100" in the right Cell.
i used from Seek and LOC but i can't get a good result and seek and LOC give a same result.
Code: |
Open "write.xls" For Binary As #2
Write #2 , A , "Test" , Size1 , Free1 , B
Next_write = Loc(#2)
Close #2
Cls : Home : Lcd "Writting End..."
Locate 2 , 1 : Lcd "Loc(#2): " ; Next_write
Waitms 2000
Open "write.xls" For Binary As #2
Seek #2 , Next_write
Write #2 , A , "Test2" , B
Close #2
Cls : Home : Lcd " Writting End2..."
|
_________________ www.mrkelectronic.blogfa.com
Best Regards |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Wed Aug 14, 2013 3:29 pm Post subject: |
|
|
Hi,
Looks as if write is adding a carrage return to the end of the first line. Maybe try copying everything into one string then just writing the string in one go.
Or use "put" to output to the file.
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 7:12 pm Post subject: |
|
|
thanks for your reply.
yes, write adding a carriage return to end of each line. and the other hand i use from PUT in Binary mode too. but seems it can't write a correct value in Excel file!
Quote: | Maybe try copying everything into one string then just writing the string in one go |
what means?
Code: |
Open "write.xls" For Binary As #2
Write #2 , A , "Test" , Size1 , Free1 , B
Next_write = Loc(#2)
Close #2
Cls : Home : Lcd "Writting End..."
Locate 2 , 1 : Lcd "Loc(#2): " ; Next_write
Waitms 2000
Open "write.xls" For Binary As #2
Seek #2 , Next_write
Put #2 , A
Close #2
Cls : Home : Lcd " Writting End2..." |
_________________ www.mrkelectronic.blogfa.com
Best Regards |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Wed Aug 14, 2013 7:18 pm Post subject: |
|
|
Hi,
Your first write is adding a carrage return to the end of the line. You'll Need to use put for all writes to the file.
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 7:59 pm Post subject: |
|
|
Quote: | Your first write is adding a carrage return to the end of the line |
my means was that PUT can't write correct data to the file.
i change my code. but it don't work!
Code: |
Dim A As Word : A = 6000
Dim B As Byte : B = 100
Open "write.xls" For Binary As #2
Put #2 , B
Next_write = Loc(#2) + 1
Flush #2
Close #2
Cls : Home : Lcd "Writting End..."
Locate 2 , 1 : Lcd "Loc(#2): " ; Next_write
Waitms 2000
Open "write.xls" For Binary As #2
Seek #2 , Next_write
Put #2 , A
flush #2
Close #2
Cls : Home : Lcd " Writting End2..." |
_________________ www.mrkelectronic.blogfa.com
Best Regards |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Wed Aug 14, 2013 8:53 pm Post subject: |
|
|
Hi,
Put writes the raw values to a file, so you Need to convert the value to a string first, then write the string to the file with put.
Try reading the bascom help text.
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
Posted: Wed Aug 14, 2013 10:54 pm Post subject: |
|
|
thanks a lot
i get my favorite result finally!
with combination Write and PUT i can to write my data in the favorite Excel Cell. with below code i can write value of "A" variable into C5 Excel Cell address.
Code: |
Dim A As Word : A = 6000
Dim Stra As String * 5 : Stra = Str(a)
Open "write.xls" For Binary As #2
For I = 1 To 5
Write #2 , Chr(0) , Chr(0) , Chr(0)
Next
Next_write = Loc(#2) - 1
Put #2 , Stra , Next_write
Close #2
|
_________________ www.mrkelectronic.blogfa.com
Best Regards |
|
Back to top |
|
|
Jamie2
Joined: 02 Jun 2014 Posts: 1
|
Posted: Mon Jun 02, 2014 1:13 pm Post subject: excel on sd card |
|
|
dear Ajaxelectronic
Hello. I am new in this Forum!
I found your posts regarding excel file on a sd card.
I want to store a few temperature data ... from my pool solar controller onto an sd card too, to make a kind of data logger.
And it should be very easy to get it on the computer. Thats why I want to use sd cards.
I´ve never done anything with sd card before with bascom.
Would you be so kind to send me a working code for handling a sd card with bascom and working with an excel file.
Would be great!
THANKS a lot in advance
best regards
Andreas |
|
Back to top |
|
|
Ajaxelectronic
Joined: 22 Nov 2009 Posts: 171 Location: Iran
|
|
Back to top |
|
|
|