[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

Serial communications 7 bit ascii

I'm using the mscomm control to communicate with a newport meter with and RS232 card.  I can send and recieve strings to and from the meter.  My problem is decoding the signal that I recieve from the meter.  Using Hyperterminal if I set the properties to force 7 bit ascii for the incoming string, I get the correct format back.  How can I force 7 bit ascii in VB or what can I do to the incoming string to decode it into 7 bit ascii?
0
JoeEinstein
Asked:
JoeEinstein
1 Solution
 
deightonCommented:
Is it possible to give a short example of the values in the incomming string?
0
 
samopalCommented:
   MSComm1.CommPort = 1 ' open Com1:
    MSComm1.Settings = "19200,o,7,1"

where
19200 -baud
o - parity (odd for this example)
7 - databit
1 - flow control
0
 
Erick37Commented:
>> 1 - flow control

1 - Stop Bits
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
JoeEinsteinAuthor Commented:
I have it set up for
9600 baud
no parity
8 databit(I tried 7 it didn't work at all)
1 stop bit

With 8 databits I can send the signal and the meter responds properly.  I have an echo activated which should return my command.  It returns it but I don't know how to get it to meen anything.  

"When transmitted, each character is preceded by a start bit and followed by one or two stop bits plus an optional parity bit, making a train of 10 or 11 baud for each transmitted chatacter."
-from Newport manual

The option I selected in hyperterminal that worked was- Force 8 incoming data to 7 bit ascii.  The help for the choice said "Translates 8 bit characters to 7 bit ascii.

I think that's what I need to know, how to translate 8 bit data to 7 bit ascii.

I can't give any examples right now though, cause the system is in use and I can't play with it right now.
0
 
Erick37Commented:
I downloaded the Communications Manual at:

http://www.newportelect.com/manuals/Process.htm

It says the factory default is
"9600,o,7,1"

Try this setting, unless you have reconfigured the meter.
0
 
JoeEinsteinAuthor Commented:
I changed the parity in the meter to none.  I tried 9600,n,7,1.  When I tried that the meter didn't respond to any of the commands and I didn't get any feedback at all.  Do you thing that changeing the parity back to odd and using 7 again would make it work?  I didn't think that the parity would make a difference as long as it matched, but I don't know much other wise I'd probably have it working.
Also if it helps the exact meter I have is INFS-2001-DC9.  I've been working on this all week I really appreciate the help.
0
 
Erick37Commented:
Try resetting the meter back to factory defaults, so you know for sure the setting.

Then write a little debbuger VB program which communicates with the meter at various settings.  Use ComboBoxes to change the settings until you hit the one that the meter is using.

You may also check the handshaking property.  Make sure it corresponds with the mode the meter is expecting: hardware, none, or Xon/Xoff

Option Explicit

Private Sub Command1_Click()
On Error Resume Next
MSComm1.Settings = Combo1.Text & "," & Combo2.Text & _
        "," & Combo3.Text & "," & Combo4.Text
Caption = "Settings: " & MSComm1.Settings
End Sub

Private Sub Form_Load()
With Combo1
..AddItem "9600"
..ListIndex = 0
End With

With Combo2
..AddItem "N"
..AddItem "O"
..AddItem "E"
..ListIndex = 1
End With

With Combo3
..AddItem "8"
..AddItem "7"
..ListIndex = 1
End With

With Combo4
..AddItem "1"
..AddItem "2"
..ListIndex = 0
End With
End Sub
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Tackle projects and never again get stuck behind a technical roadblock.
Join Now