Page 1 of 1

writing data to file

Posted: 26 March 2008, 20:34 PM
by abcuser
I am collecting a set of data using pulsein(). I am able to get the pulse width but would like to know if I can store it in a text file. I am using the zx-24a. Any help would be appreciated.

Re: writing data to file

Posted: 26 March 2008, 21:27 PM
by dkinzer
abcuser wrote:I [...] would like to know if I can store [output data] in a text file.
There is no simple way to do so but it can be done indirectly. If you are outputting the collected data to Com1 and you are using the IDE, you can select the data that appears in the Debug window using the mouse and then copy it to the clipboard using ctrl-C. Subsequently, you can paste the clipboard data into any application that accepts text and save it. Note that the Debug window only keeps the last 100 lines by default. If you have more data than that you can increase the Debug Output Limit.

The second alternative is to capture the output from Com1 using the ZLoad utility. The most straightforward way to to this is to redirect the output to a file:

Code: Select all

zload -m > data.txt
The disadvantage of this method is that you can't see the data as it is being output. A workaround is to use the undocumented "logging" ability of zload:

Code: Select all

zload -mdata.txt
This command outputs the received data to the named file (data.txt) and also routes it to the console so that you can see it.

A third alternative is to use one of the many terminal programs that supports data logging. I use TeraTerm but there are many of this type of "terminal emulator" program from which to choose.

Posted: 27 March 2008, 8:41 AM
by stevech
or with greater difficulty, interface an SD card via SPI. I've downloaded, read about, but not used C code for an AVR that implements Mirosoft's FAT16 file system, as you see on SD cards for digital cameras, mp3 players, etc.

Re: writing data to file

Posted: 01 April 2008, 21:17 PM
by abcuser
" The second alternative is to capture the output from Com1 using the ZLoad utility. The most straightforward way to to this is to redirect the output to a file:

Code: Select all

zload -m > data.txt
"


where would I enter the code 'zload -m > data.txt'. I try to do it in the zload.exe using command prompt while Zbasic ide was open but it gave me the message 'Can't open COM1'.

Posted: 02 April 2008, 8:00 AM
by dkinzer
The application zload.exe is a command line utility; it must be invoked from the command line. If you don't have an icon for "Command Prompt" on your desktop, you should be able to find it on the "Accessories" sub-menu of the "Start->Programs" menu.

In order for this to work, you'll either need to exit the ZBasic IDE application or close the serial port manually. There is an entry on the Options menu for doing so.

Posted: 02 April 2008, 19:05 PM
by liam.zbasic
Is there a RS232 compliant serial-out command?

Posted: 02 April 2008, 19:23 PM
by dkinzer
liam.zbasic wrote:Is there a RS232 compliant serial-out command?
I'm not sure I understand the meaning of your question. All characters that are added to a queue that is associated with a serial channel as the output queue are transmitted in compliance with RS-232 framing and timing requirements. The signal levels are not RS-232 compliant unless you add the external level converter circuitry. The control flow signals (DTR, DSR, DCD, RTS, CTS) are not implemented nor is the XON-XOFF protocol.

What other aspects of the RS-232 standard are you concerned about?

Posted: 02 April 2008, 19:53 PM
by abcuser
Got it. Thanks