Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help!!serial using vb6 (always display character '?')

Status
Not open for further replies.

maggots

Member level 4
Joined
Apr 4, 2007
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,740
hey guys...thx for your time ...

I have a project using another hardware device.The device communication with computer using serial port.
first,If i try to connect it with hyperterminal program from windows ... it doesn't have problem.(my hardware ok..)
but if try to connect to vb program the character that i show with label1.caption always '?'
but if try using my vb program and short the rx dan tx pin(its looping itself),
the character i send and receive and then display in label1.caption is right...
Character 'A' and 'B' is displayed...


here is my code...
Code:
Code:
Private Sub cmdM_Click() 
       UartCom.InBufferCount = 0 
       UartCom.Output = Chr(65)          'display A
       UartCom.InputLen = 1 
       S = "" 
       On Error Resume Next 
       Do 
       dummy = DoEvents() 
          'If there is data in the buffer, then read it. 
          If UartCom.InBufferCount Then 
             S = S + UartCom.Input
          Exit Do 
          End If 
       Loop Label1.Caption = S 
End Sub
Private Sub cmdM_Click() 
       UartCom.InBufferCount = 0 
       UartCom.Output = Chr(66)          'display B
       UartCom.InputLen = 1 
       S = "" 
       On Error Resume Next 
       Do 
       dummy = DoEvents() 
          'If there is data in the buffer, then read it. 
          If UartCom.InBufferCount Then 
             S = S + UartCom.Input
          Exit Do 
          End If 
       Loop Label1.Caption = S 
End Sub
Private Sub Form_Load() 
    'setting serial 
     UartCom.CommPort = 1 
     UartCom.Settings = "9600" & "M" & ",8,1" 
     UartCom.PortOpen = True 
End Sub


thx for helping me,guys...
sorry if my english is bad...
 

Hi,
What does your hardware output when you send 'A' or 'B' to it?, is it ASCII characters?

What does 'M' stand for in " "9600" & "M" & ",8,1" ?

Regards,
Laktronics
 

laktronics said:
Hi,
What does your hardware output when you send 'A' or 'B' to it?, is it ASCII characters?

What does 'M' stand for in " "9600" & "M" & ",8,1" ?

Regards,
Laktronics

I think he means "N"???

maggots:
Read the vbcom.pdf file here:


If you follow this, you will be able to make your own program in minutes.

Good Luck
 

I found this VB code I did a long time ago. It is a very, very basic send and receive program ( I mean very Basic!)

The program will send whatever you type in textbox1 and display whatever is received in textbox2. It does not use any interrupts or OnCom Events.

with this, and the PDF file in the link above, you will be well on your way.

Good Luck
 

laktronics said:
Hi,
What does your hardware output when you send 'A' or 'B' to it?, is it ASCII characters?

What does 'M' stand for in " "9600" & "M" & ",8,1" ?

Regards,
Laktronics

ya, its ASCII character...

M stand for i'm setting parity is mark....I use mark cause i'm using Multi-processor communication mode(MPCM) in AVR ... so i can talk to many address(uC) using RS-485.
In MPCM, first i must sending mark parity for give address of uC that i want to communicate...then sending space parity for give the right address a command..

Added after 3 minutes:

ctownsend said:
laktronics said:
Hi,
What does your hardware output when you send 'A' or 'B' to it?, is it ASCII characters?

What does 'M' stand for in " "9600" & "M" & ",8,1" ?

Regards,
Laktronics

I think he means "N"???

maggots:
Read the vbcom.pdf file here:


If you follow this, you will be able to make your own program in minutes.

Good Luck

i dont use No bit parity setting ...

oh thx for the basic program... i will try that one..
 

Hi,
OK, that makes it clear. But now the question is if PC UART is configured for MARK parity, does the responding salve also send data with MARK parity?, since when you loop back TX/RX you are receiving data with MARK parity and your system works with loop back.

Regards,
Laktronics
 

    maggots

    Points: 2
    Helpful Answer Positive Rating
laktronics said:
Hi,
OK, that makes it clear. But now the question is if PC UART is configured for MARK parity, does the responding salve also send data with MARK parity?, since when you loop back TX/RX you are receiving data with MARK parity and your system works with loop back.

Regards,
Laktronics

Hi laktronics...
thx for your care...
yesterday i know where is my bug...
the bug is not in vb but my program in slave..(which i doesnt show to you..sorry)
for change the parity, i must have change TXB8...(in attiny2313):D:D

but will you help me again...
i have another problem...
here is the topic

thanks..arigatou..

Added after 3 minutes:

oh ya...
character '?' show in vb6 cause
if parity that vb received doesnt same with setting MSComm .. if u display it will show '?'
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top