|
-
Jun 9th, 2008, 07:50 AM
#1
Thread Starter
Lively Member
-
Jun 9th, 2008, 08:08 AM
#2
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?
-
Jun 9th, 2008, 08:12 AM
#3
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
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jun 9th, 2008, 08:15 AM
#4
Thread Starter
Lively Member
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
-
Jun 9th, 2008, 08:57 AM
#5
Re: Serial Port Coms and External LED Display
Last edited by dbasnett; Jun 9th, 2008 at 10:50 AM.
-
Jun 9th, 2008, 10:49 AM
#6
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.
-
Jun 9th, 2008, 04:45 PM
#7
Thread Starter
Lively Member
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.
-
Jun 9th, 2008, 06:15 PM
#8
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
-
Jun 9th, 2008, 06:35 PM
#9
Thread Starter
Lively Member
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
-
Jun 9th, 2008, 06:35 PM
#10
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.
-
Jun 9th, 2008, 06:56 PM
#11
Thread Starter
Lively Member
-
Jun 10th, 2008, 07:00 AM
#12
Re: Serial Port Coms and External LED Display
-
Jun 10th, 2008, 04:51 PM
#13
Thread Starter
Lively Member
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
-
Jun 11th, 2008, 05:04 AM
#14
Addicted Member
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:
Do Until DesiredResultAchieved
AskMyself_WhyDoINeedToDo()
FigureOut_WhatINeedToDoInOrderToDoThat()
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!
-
Jun 11th, 2008, 05:40 AM
#15
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.
-
Jun 11th, 2008, 06:39 AM
#16
Re: Serial Port Coms and External LED Display
Copy paste post 6 again. The page number business wants ascii.
-
Jun 11th, 2008, 09:58 AM
#17
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|