Serial port reading using PHP.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • boonboy28
    New Member
    • Apr 2007
    • 2

    Serial port reading using PHP.

    I have a BS microcontroller sending data over the serial port to a pc with php. the data is indeed sent as it is displayed within the terminal window. So I have sent and received data over the serial link. But I cannot seem to capture the data using php, all I want to do is capture the data and display it on a web page. I Have used fread, fgets, looked into the uart fifo buffer and also looked into data streams, but there is so much I'm a bit lost.
    When I try to fread, the web page just freezes any of you php gurus have any good ideas.

    Thanks.

    From the nubee
    boonboy
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    all I want to do is capture the data and display it on a web page
    This is quite a specialised subject. Before you can start to process the data you need to be able to read the data stream and understand its protocols.
    I Have used fread, fgets, looked into the uart fifo buffer and also looked into data streams,
    These are FILE commands. You are trying to read a serial port. You need the address of the port to start with, then an understanding of the HI and LO ports and whether using 16 bit or 32 bit. I recommend reading through the port using C, into a file, then read the file and output to web page using php. You have a long way to go

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      What environment (OS) are you using?
      It is unlikely that the user Apache runs as will have permission to access your serial port by default. You will probably need to modify the permissions (or the user) which Apache is run as.

      Comment

      • boonboy28
        New Member
        • Apr 2007
        • 2

        #4
        Originally posted by Motoma
        What environment (OS) are you using?
        It is unlikely that the user Apache runs as will have permission to access your serial port by default. You will probably need to modify the permissions (or the user) which Apache is run as.
        I am using debian. My web page writes to my device using fopen & fwrite as linux treats all devices just like files, i changed the permissions of the port to read,write,exec ute for all using chmod 777. Device is also replying back (The returned value from my device shows in the debug window) all I need to do is take the value that has been sent & display it. Could it be an issue where the fread command is missing the data being sent.

        Comment

        • waterman
          New Member
          • May 2007
          • 1

          #5
          Originally posted by boonboy28
          I have a BS microcontroller sending data over the serial port to a pc with php. the data is indeed sent as it is displayed within the terminal window. So I have sent and received data over the serial link. But I cannot seem to capture the data using php, all I want to do is capture the data and display it on a web page. I Have used fread, fgets, looked into the uart fifo buffer and also looked into data streams, but there is so much I'm a bit lost.
          When I try to fread, the web page just freezes any of you php gurus have any good ideas.

          Thanks.

          From the nubee
          boonboy
          Have a look at this, it may help
          http://hardware.newsfo rge.com/article.pl?sid= 06/02/02/1647248&tid=87

          Comment

          Working...