Shop OBEX P1 Docs P2 Docs Learn Events
Beginner:: Logging Data from Transmitt window of Serial Terminal — Parallax Forums

Beginner:: Logging Data from Transmitt window of Serial Terminal

oodesoodes Posts: 131
edited 2013-01-09 14:53 in General Discussion
Hello guys

I'm a newcomer to the world of Spin and Parallex and I have limited knowledge but I wonder could you's point me in the right direction. I wanna capture data that I randomly type into the Transmit Bar on the Serial terminal and write it to a text file that I will save on a Sd card. I have looked at the example file EnterAndDisplayValues.spin but im looking to save the characters (they dont have to be converted into hex or binary just junk characters to show the functionality of it)

Cheers in advance

Des

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-09 07:33
    There are two parts to your task: 1) Get characters from the Serial Terminal program and save them in memory; 2) Write the characters or some processed version of them to an SD card file.

    1) You need to look at the various methods (subroutines) in FullDuplexSerialPlus (or any other serial I/O object that you care to use). In addition to the .getDec method, there are others that input characters into a buffer and process them into numeric values. There's a .getStr method that inputs a line of text (terminated by a Return character) into a byte array you supply. You can also use .rx directly which supplies one character at a time.

    2) Look at either Kye's SD Card Object or FSRW 2.6. The former is better documented and more detailed. The latter is smaller and more commonly used. Both have methods for creating files and for writing single bytes to them or strings of bytes. It's simple to add methods (from other objects like FullDuplexSerialPlus) to handle numeric values if that's what you want.
  • oodesoodes Posts: 131
    edited 2013-01-09 14:53
    Thanks Mike I managed to get something up and running earlier. I have looked at these examples and they have been very useful. I'm running it in conjunction with an LCD display so that as i type the random characters it is displayed on the LCD and saving to a txt file simultaneously I've managed to get it displaying the characters on the LCD and creating a text file but cant get it to save the data in the text file yet, but I'll figure that out tomorrow. One other question that maybe you could help with. I want my string of data to be a max 80 characters and the transmission to stop should i reach this value and also have a terminate button like ' ~ ' or something. I'm just wondering how might I assign a character to terminate the process.

    Thanks in advance.

    DEs
Sign In or Register to comment.