Shop OBEX P1 Docs P2 Docs Learn Events
Terminal with Mem-Stick Logger---Need Help! — Parallax Forums

Terminal with Mem-Stick Logger---Need Help!

Alex BellAlex Bell Posts: 17
edited 2009-01-29 18:42 in Propeller 1
My friends and I (newbies) have been trying to develop a Terminal Emulator that logs all keystrokes and com port input to a thumb-drive memory stick as well as to a local printer. As seen in the enclosed developing files, we have arranged Propeller VGA, keyboard, and serial port software which actually runs as a terminal and copies out the secondary (printer port). However, we cannot capture the keystrokes to the thumb drive! The thumb drive "seats", the file directory and file are written to the drive, and even some of the embedded and "0" terminated DAT strings are copied into the file...however the keystrokes or input from the COM port never appears. Can anyone see why? We are mystified! We really need the thumb drive to work as it is the "green" part of the project, to save paper! Thanks for any light you can give!

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2009-01-28 20:26
    Hello Alex,

    first of all I had to add

    PUB print (p)
    
    PUB CLS
    
    PUB print_box(a,b,c,d)
    
    PUB print_char(a,b,c)
    
    PUB print_str(a,b,c)
    
    PUB save
    
    PUB restore
    
    
    



    step by step just to get your project to compile
    of course this code will NOT work properly
    it was just for compiling it to get easy access to the subobjects by doubleclicking on
    the filenames in the object-info windows of the poptool

    you should always use the archive function of the proptool to ensure that ALL files that are compiled on your PC
    are included in your attachment

    I took a quick and short look into your code.
    Do you get output on the Display and the printer ?

    In the Paul_USBDemo there is a line of code

      if USB.checkErrorCode == 0
    
    



    which is missing in your code

    did you test WITHOUT changing to a subfolder ?

    You are checking if something comes in on the SERIAL connection

        if (x := Terminal.rxcheck) > $00
          Video.print(x)
          Terminal2.tx(x)
          USB.Write(x)   
    
    



    and no keystrokes

    I did NOT test your complexe line of code

    code]
    if (x := Terminal.rxcheck) > $00
    [noparse][[/noparse]/code]

    I would test this line for itself
    or "decompress" it to less complex lines of code

      x := Terminal.rxcheck
      if x > 0
    
    



    whenever there occurs an error
    you have to check EVERY detail on its own
    otherwise you will be mystified as you said yourself

    Now I took a look into the method PUB Write in the Paul_USBdrive.spin

    PUB Write(fileData) | length         ' Write data to file (file must be preopened)
      length := strsize(fileData)
    
    



    the method Write expects a POINTER to a string
    for writing an integervalue you have to create a new method
    WriteDec that calculates the length of the integervalue and sends the same commandbytes like
    method write and then calls the dec method of the FullDuplexSerial-object
    or you have to use a method that converts the integervalue into a string and use the POINTER to this string
    (NOT the string itself !) as the parameter of the call of method USB.Write

    I THINK this is the bug. You know it if you really tested it

    best regards

    Stefan
  • Alex BellAlex Bell Posts: 17
    edited 2009-01-29 18:42
    Thank You, Stefan. After reviewing the Propeller Manual I know I need to learn about Pointers. I think you have found the bug! Sorry about not uploading all of the files together, I tried but the Forum would only let me upload 5 of 7. Cheers!
Sign In or Register to comment.