Results 1 to 17 of 17

Thread: [RESOLVED] Serial Port Coms and External LED Display

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Resolved [RESOLVED] Serial Port Coms and External LED Display

    Hi all

    I hope this is the correct place to post this, if not, I apologise.

    I'm trying to write a VB2005 app that will communicate via serial port with two external LED displays. While I can do the VB side of things, I'm completely stumped by the communications protocols used to talk with the displays

    Can anyone help me out and try and decipher the protocols so that I know what strings to send to the displays? (pdf attached).

    The company in question (Polycomp) will quiet happily write me something for an extortionate price, but that's as far as they will go

    Thanks in advance

    Andy
    Attached Images Attached Images

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    The PDF had a sample program(s). So what exactly are you trying to do with the sign?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Serial Port Coms and External LED Display

    But apart from that.
    If you want to sned receive data u will use the io namespace.

    P.E. you want a 9600 connection with com1, so:
    Dim p As New System.IO.Ports.SerialPort("COM1:", 9600)

    After that try checking the p values see if you can progress
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    It does have an example program, but I'm confused about what most of the sections of the string which is submitted to the display does.

    What I'm trying to do is write a program that has full control over not only the message content, but the format / effects of the message on the display.

    It's not visible to me what string / format of string to throw at the signs to get the relevant output.

    For example, what string would I send to the signs to display a 'Hello World' message that scrolled from left to right?

    Hope that explains a bit better.

    Andy

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    See next post...
    Last edited by dbasnett; Jun 9th, 2008 at 10:50 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    Geez D, sorry. Let me try again.

    Code:
        Dim myMSG() As Byte = New Byte() {}
        Dim testMSG As String = "dbasnett is the best :-)!!" 'humor
        Dim theHdr() As Byte = New Byte() {0, 1, 0, 3, CByte((2 ^ 7) + (2 ^ 6)), Asc("0"), Asc("0"), Asc("1")}
        Dim theSched() As Byte = New Byte() {} 'New Byte(17) {}
        Dim theTempo As Byte = 225
        Dim theFunc As Byte = 15
        Dim thePageStat As Byte = 128
        Dim theTrl() As Byte = New Byte() {4, 0}
        Dim msgSiz As Integer, msgPOS As Integer
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            msgSiz = theHdr.Length + theSched.Length + 3 + testMSG.Length + theTrl.Length 'calc size of message 
            Array.Resize(myMSG, msgSiz)
            msgPOS = 0
            Array.Copy(theHdr, 0, myMSG, msgPOS, theHdr.Length) 'copy the header to msg
            msgPOS += theHdr.Length
            Array.Copy(theSched, 0, myMSG, msgPOS, theSched.Length)
            msgPOS += theSched.Length
            myMSG(msgPOS) = theTempo
            msgPOS += 1
            myMSG(msgPOS) = theFunc
            msgPOS += 1
            myMSG(msgPOS) = thePageStat
            msgPOS += 1
            Encoding.ASCII.GetBytes(testMSG, 0, testMSG.Length, myMSG, msgPOS) 'convert string to bytes
            msgPOS += testMSG.Length
            Array.Copy(theTrl, 0, myMSG, msgPOS, theTrl.Length) 'copy trailer
            For x As Integer = 0 To myMSG.Length - 2 'calc checksum
                myMSG(myMSG.Length - 1) = myMSG(myMSG.Length - 1) Xor myMSG(x)
            Next
            'SP.Write(myMSG, 0, myMSG.Length)
    Last edited by dbasnett; Jun 11th, 2008 at 06:37 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    That certainly gets a response. Unfortunately it's just gobledy gook on the display. No matter what the message is, the display shows exactly the same garbled message, so there's probably something wrong with the header format / length?

    Last edited by Duckfather; Jun 9th, 2008 at 05:46 PM.

  8. #8
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    have you checked the serial port settings? the web site says :
    BAUD RATE : 1200 – available up to 19,200
    START BIT : 8
    STOP BITS : 1
    PARITY : NONE

    the pdf says
    BAUD RATE : 9600
    START BIT : 1
    STOP BITS : 2
    PARITY : NONE
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    Yup. I've taken the display cover off and checked the dip switch settings from the website (http://www.polycomp.co.za/Dipswitch.html)

    The displays are running at
    Baud : 9600
    Start bits : 8
    Stop bits : 1
    Parity : None

    I'll have a play with the dip switch settings tomorrow to make sure, but it doesn't look like that

  10. #10
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    I edited post 6 to get rid of the schedule business. Try again.

    I have to say that is some bad documentation.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    I'll try that in the morning

    Yeah, the documentation is confusing as hell. Well, certainly to me

    Oh, btw, thanks for the help so far

  12. #12
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    Good luck.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    Ok, here's the wierd results of todays testing.

    All COM port settings are correct, so we can rule that one out.

    Pairing the code back to the following gets a static message on the screen :-

    Code:
        Dim myMSG() As Byte = New Byte() {}
        Dim testMSG As String = "Message "
        Dim theHdr() As Byte = New Byte() {0, 1, 0, 3}
        Dim theTrl() As Byte = New Byte() {4, 0}
        Dim msgSiz As Integer, msgPOS As Integer
    
        Dim WithEvents serialPort As New IO.Ports.SerialPort
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
             msgSiz = theHdr.Length + testMSG.Length + theTrl.Length 'calc size of message 
            Array.Resize(myMSG, msgSiz)
            msgPOS = 0
            Array.Copy(theHdr, 0, myMSG, msgPOS, theHdr.Length) 'copy the header to msg
            msgPOS += theHdr.Length
            Encoding.ASCII.GetBytes(testMSG, 0, testMSG.Length, myMSG, msgPOS) 'convert string to bytes
            msgPOS += testMSG.Length
            Array.Copy(theTrl, 0, myMSG, msgPOS, theTrl.Length) 'copy trailer
            For x As Integer = 0 To myMSG.Length - 2 'calc checksum
                myMSG(myMSG.Length - 1) = myMSG(myMSG.Length - 1) Xor myMSG(x)
            Next
    
            serialPort.Write(myMSG, 0, myMSG.Length)
    This results in a static message a max of 8 chars long (the size of the display). But if I then send a message 5 chars long (for example), the last 3 chars are not overwritten and any message longer than 8 chars is chopped off.

    Why reducing the header from

    Code:
    Dim theHdr() As Byte = New Byte() {0, 1, 0, 3, CByte((2 ^ 7) + (2 ^ 6)), 0, 0, 1}
    to

    Code:
    Dim theHdr() As Byte = New Byte() {0, 1, 0, 3}
    works I don't know. This obviously seems to remove any possibility of effects for the message (ie scrolling etc). Including any more in this string just produces rubbish on the display, but every rubbish character on the display can be changed by changing the

    Code:
    CByte((2 ^ 7) + (2 ^ 6)), 0, 0, 1
    portion of the string (ie changing CByte((2 ^ 7) + (2 ^ 6)) changes the first char on the screen, changing the first '0' changes the second char etc)

    This suggests that the display is incapable of special effects, but I know for a fact that it does them because I already have a piece of software (no source code unfortunately) that scrolls the text from right left and copes with a message larger than the screen (1 line of 8 chars).

    So, to roundup. I can display an 8 char message, but as a bare minimum, I must be able to scroll the message from right to left.

    Any ideas?

    Andy

  14. #14
    Addicted Member
    Join Date
    Mar 2008
    Posts
    150

    Re: Serial Port Coms and External LED Display

    I have quickly read this thread and their documentation. From what I can understand, you need to send your entire message to the display in one "short burst" (less than 40 seconds). So you need to send multiple 8 character strings as per their protocol, and it (the display) should handle the rest assuming you've sent the correct strings to it (you should get the ACK?).

    I'm not really able to help you with the technical side but perhaps understand what it is you need to achieve, would be a great place to start!
    vb Code:
    1. Do Until DesiredResultAchieved
    2.   AskMyself_WhyDoINeedToDo()
    3.   FigureOut_WhatINeedToDoInOrderToDoThat()
    4. Loop

    OMG I just solved all the problems of the world ;-)
    Last edited by scootabug; Jun 11th, 2008 at 05:06 AM. Reason: Nerdying it up!

  15. #15
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    What model of sign do you have?

    You could get a Hex editor and have a look at the program you have, if you know the message it puts on the screen.

    You could also email Polycomp and tell them what you think the byte sequence is generically and ask them if that is correct.

    It is confusing.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  16. #16
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Serial Port Coms and External LED Display

    Copy paste post 6 again. The page number business wants ascii.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Jun 2008
    Posts
    90

    Re: Serial Port Coms and External LED Display

    Ok. So I've been in touch with Polycomp UK, who were happy enough to help out.

    It seems that I've been given the wrong protocols for these displays!

    (correct protocols attached)

    Sorry, guys, it seems I've unwittingly led you up the garden path

    These correct protocols explain why only the first part of the header worked. In these protocols there is no more to the header! It turns out that this display is an older version with limited functionality. The display is also incapable of special effects (apart from flashing and enlarged text). However, you can specify where on the display the message starts.

    As a result, I've knocked together some code that gives the 'illusion' of scrolling by incrementing the message start location and re-sending the message multiple times.

    Thanks for all the help guys. Without your code it would have been a very steep uphill struggle for me to get this far

    I will certainly be coming back here the next time I have a problem

    Cheers

    Andy
    Attached Images Attached Images

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width