Shop OBEX P1 Docs P2 Docs Learn Events
How to write the code "Unauthorized" in one line using datalogger. — Parallax Forums

How to write the code "Unauthorized" in one line using datalogger.

sugusharma238sugusharma238 Posts: 7
edited 2010-08-05 03:27 in BASIC Stamp
Hello Sir/Madam,

I am currently working on the BS2 stamp (on the parallax homework board) along with the data-logger and the RFID reader.

Motive: When a person tries to access a locked door, he/she flashes their RFID tag infront of the RFID reader (placed on the door). The reader then identifies whether this tag is authorized or not. If the tag is authorized/ successfully found, it stores the name and time of the person's arrival and opens the door for them.

I am currently working on writing the person's name to the file along with the unauthorized or authourized key words.

The program attached below creates a new file named "NEWFILE" and writes "Unauthorized" or "Tag 1 (White card) ivan" VERTICALLY to the file when a RFID tag is read by the RFID reader.

Could someone advice how I could write the same output "Unauthorized" or "Tag 1 (White card) ivan" HORIZONTALLY instead?

Any advice would be greatly appreciated [noparse]:)[/noparse]

Thank you.

Sugandha Sharma

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-07-24 00:50
    Hi , append a carriage + line feed to your text

    eg:· SEROUT TX, Baud, [noparse][[/noparse]"WRF",$0,$0,$0,$0E,CR,"Unauthorized",CR,$0A,CR]

    Check out this link for an alternative view· http://forums.parallax.com/showthread.php?p=807516

    Jeff T.
  • RiJoRiRiJoRi Posts: 157
    edited 2010-07-26 21:54
    Here in the real world -- I work for a manufacturer of alarm systems -- we assign a 3-digit user number to the RFID cards. So if a card has the number 123-456-7890, it might get assigned to user 002. This way, we do not need to keep track of people's names: "002" uses a lot less space than, say, "Sugandha Sharma".

    --Rich
  • sugusharma238sugusharma238 Posts: 7
    edited 2010-07-28 02:12
    Dear jeff.

    The thing is that what we are trying to do is write a string variable (this variable is a constant but dependent on the RFID identification number) since we have 4 tags and only 2 of them are authorized.

    when the unauthorized tag hits the RFID reader, the program starts reading the constant that says (unauthorized) and it reads by grabbing each letter and writing it to the USB in the data logger.

    the two problems is that the program is writing in the following way

    0

    WRu
    WRn
    WRa
    WRu
    WRth
    WRo
    WRr


    and the second problem is that
    without writing LF

    PAUSE 1
    SEROUT TX\CTS, BaudDL, [noparse][[/noparse]"WRF ", $00, $00, $00, $05, CR, DEC enter, LF,CR]
    GOSUB Get_Serial_Bytes

    the file NEWFILE

    doesnt get created

    can you give us some idea on how to address these issues.

    we are using homework board bs2 stamp
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-07-28 15:37
    Hi , take a look at the modifications I made to your original code and see if it will run .

    I have not tried this but it looks to me like things just need shuffling round a little in the Show_Name sub routine

    Let me know what you see when you try this whether it runs or not

    Jeff T.
  • sugusharma238sugusharma238 Posts: 7
    edited 2010-07-30 01:45
    Hi Jeff,

    Thank you for your reply.

    Your corrections targeted the Debug terminal. Unfortunately we are still experiencing the same issues as before with the LF command, output being written vertically and now it is appearing twice in the NEWFILE made using the datalogger.

    The output file is as below:


    0

    WRU
    n

    n
    a

    a
    u

    u
    t

    t
    h

    h
    o

    o
    r

    r
    i

    i
    z

    z
    e

    e
    d

    d


    If you paste this into a txt file. That is the exact file I am reading whenever i take out the usb stick and put it in to the laptop.

    Thanks for your help.

    Sugu
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-07-31 01:34
    Hi Sugu , can you attach the actual BS2 file that you used to get that result.

    The modifications I attached in my last post may not have been 100% but I don't see how it could have given the results you received.

    The fact that Debug is displaying the word "Unauthorized" continuously in a horizontal manner is encouraging·so writing to the logger in the same format·is not too far away

    Jeff T.
  • sugusharma238sugusharma238 Posts: 7
    edited 2010-07-31 02:02
    Hi Jeff,
    certainly Here is the code that i used.

    thanks so much for your help
    sincerely

    Sugu
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-07-31 14:02
    Hi , I think there was a misunderstanding in my previous edits . I had used a strike through (strikethrough) on the text to show you what I was replacing and it got included in the code again.

    Anyway in this attachment I have deleted those lines , try it and see if it runs .

    Jeff T.
  • sugusharma238sugusharma238 Posts: 7
    edited 2010-08-02 00:26
    Dear Mr. Jeff,

    Thank you for your response.

    The program worked flawlessly!! [noparse]:)[/noparse]

    Your edits currently give the following output:

    Tag 1 (White Card)IvanUnauthorized
    The only other problem I am facing now is that the separate·outputs (i.e. Tag 1 (White Card)Ivan and Unauthorized)·do not have a space between them·and or do no·go to the next line when written to the NEWFILE.

    Thanks once again for your help.

    Sugandha Sharma.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-08-02 21:55
    Hi Sugandha , the sub routine Show_Name is now set up to read a zero terminated string that you have stored as DATA , the·sub routine reads one character of data at a time until it reaches that zero.

    To have spaces or additional characters·between words you must include them in your DATA instruction before the zero. For example

    [font=Helvetica, sans-serif]Name0 DATA "Unauthorized (space here) ", CR, 0[/font]

    [font=Helvetica, sans-serif]Name1 DATA "Tag 1 (White Card)Ivan (space here)", CR, 0[/font]
    Formatting the data so that it puts each record on a separate line is also done in the DATA instruction using CR and LF (carriage return and line feed) . CR = decimal 13 , LF = decimal 10. For example

    [font=Helvetica, sans-serif]Name0 DATA "Unauthorized ", $0D , $0A , 0[/font]

    It's down to you to experiment until you find the format that suits you

    Jeff T.

  • sugusharma238sugusharma238 Posts: 7
    edited 2010-08-05 03:27
    Dear Mr. Jeff,

    Thank you for your continued support. I really appreciate it.

    I was able to fix my previous joined words and am now facing some issues with my time keep chip program.

    I hope you can help me with this last concern.

    I am at the final stage of my program where I am trying to write the date, month, year and time (using the Time keeping chip) onto the "NEWFILE" via the data-logger.

    I am currently able to set up the date, month, year and time but am not able to get the write numbers written onto the NEWFILE. The output is as follows:

    Unauthorized
    80138

    Therefore, it is currently displaying in the order of month, day, year, hours and minutes. The data inputed when asked to enter the time was: 08(month), 04(day), 10(year), 22(hours as it is a 24 hour clock) and 50(minutes.) The 1st few digits of the output, such as 8 (month), 0 (missing 4 for day), 1 (missing 0 for year) make sense but the others dont.

    I am trying to make the output appear as follows:

    Unauthorized
    804102250

    Can you suggest a way I may do that?

    Ps. The file is attached below.

    Thanks once again and Hope you have a wonderful rest of the week [noparse]:)[/noparse]

    Sugandha Sharma.
Sign In or Register to comment.