0

simple rs232 control using TTL level



We have a HD410 player and need to control it by rs232 at TTL level.

1) We need to have a looping "intro" video I will call (file1.mpg)
2) we need to send command by rs232 to play either file2.mpg or file3.mpg
3) When commanded file is complete, file1.mpg should loop again.
4) rs232 needs to be 9600 baud or less.

I have spent a couple of hours looking at post on this site but am not sure what to do. I know this is super simple for you but I would appreciate it if you could let me know what is needed to make this work. Do I need to write a script or is this function built in?

10 comments

  • 0
    Avatar
    RokuLyndon


    You can do this using an interactive playlist, no scripting required. The following example assumes you are sending the file name as a string to play the file you want played. For example, "file2" for file2.mpg and "file3" for file3.mpg.



    If you haven't already done so, please update your unit to firmware 3.1.



    This is the text version autoplay.csv file I sent you via email. In this example, sending the command while either file2 or file3 is playing will play the correct file. You can also set it so that commands received while file 2 or 3 is playing will be ignored.



    SERIALPORTSPEED,9600,,,

    SERIALPORTMODE,8N1,,,



    EVENTS,,serial:file2,serial:file3,videoend

    STATE,file1.mpg,file2.mpg,file3.mpg,

    STATE,file2.mpg,file2.mpg,file3.mpg,file1.mpg

    STATE,file3.mpg,file2.mpg,file3.mpg,file1.mpg



    Interactive playlists are covered in chapter 4 of the user's guide. Let me know if you have any other questions.
  • 0
    Avatar
    atprf


    I looked at the documentation and it wasn't clear to me, but is it correct to assume that

    1) the 5V Serial and 9-Pin Serial ports are the same port?  

    2) What you send to the serial port comes out both the 5V and 9-Pin plugs?



    and...I'm assuming that terrible things (or a wired-or effect) happen if you send serial into both sockets at the same time?
  • 0
    Avatar
    RokuLyndon


    The CSV file only addresses the 5 volt serial port. No, they aren't the same. To use the 9volt serial port would require a custom script.
  • 0
    Avatar
    teamkingsley


    I am still having some issue. I am sending a string "file2". Do I need to also send a CR? Should I send a string as "file2.mpg"? (just thought of that)



    I am sending 5V TTL with the tip and base as ground on the 1/8 stereo plug.



    9600 8N1



    I am using a basic stamp. I have used these for years using the serial to communicate with a wide variety of devices. I know I am missing something simple. Any ideas?
  • 0
    Avatar
    RokuLyndon


    I'm sorry but I just realized I misspoke earlier. The serial port that the csv accesses by default is the 9pin rs232 port, not the 1/8 inch jack. This is why you are having problems.



    Yes, when sending a string, you should use a csv file. The string can be anything, so long as it matches what's in the csv file, in the events row.
  • 0
    Avatar
    teamkingsley


    So I can not use the 5 volt TTL control? If I use the 9 pin I will need to use a MAX233 chip to convert to 12 volt rs232.
  • 0
    Avatar
    RokuLyndon


    It's not that you can't use it. The csv file by default creates a serial object for the 9 pin port, not the 1/8" jack. You would need co create a custom script to address the other serial port.
  • 0
    Avatar
    teamkingsley


    Will this script be just a few lines of code?



    Create in Notepad and put on SD card?



    Can you help me get started on the script?



    Example?
  • 0
    Avatar
    RokuLyndon


    Hi,



    I have something simpler to try first.



    To create a serial object, we normally use:

    serial = CreateObject("roSerialPort", 0, 9600)





    To use the other serial port, it would be:

    serial = CreateObject("roSerialPort", 1, 9600)



    I've modified the autorun script so that it uses the other serial port for the csv file. I'm emailing you the updated autorun file for you to test. You can use the same csv I sent you previously.



    Please update your unit to 3.1 firware, if it's running older firmware. Just copy the autorun.brs I sent to your flash card along with the autoplay.csv you have currently.
  • 0
    Avatar
    teamkingsley


    Thanks! It looks like this will work.



    I found that I also needed to send the TTL rs232 INVERTED



    I am able to command a file to play by rs232 on the 1/8 jack now.



    I will now incorporate this into my other code and test it.
Please sign in to leave a comment.