i have to comunicate from vb to control a nec vt480 and I have not much idea how to send the instructions correctly .
Acording to the information given by nec, this are the codes to control projector:
001. POWER ON 02H 00H 00H 00H 00H 02H
002. POWER OFF 02H 01H 00H 00H 00H 03H
003. INPUT SELECT RGB(*5) 02H 03H 00H 00H 02H 01H <DATA> CKS
004. INPUT SELECT VIDEO 02H 03H 00H 00H 02H 01H 06H 0EH
005. INPUT SELECT S-VIDEO 02H 03H 00H 00H 02H 01H 0BH 13H
006. PICTURE MUTE ON 02H 10H 00H 00H 00H 12H
007. PICTURE MUTE OFF 02H 11H 00H 00H 00H 13H
008. SOUND MUTE ON 02H 12H 00H 00H 00H 14H
009. SOUND MUTE OFF 02H 13H 00H 00H 00H 15H
010. ONSCREEN MUTE ON 02H 14H 00H 00H 00H 16H
011. LAMP INFORMATION REQUEST 03H 8CH 00H 00H 00H 8FH
012. MUTE CONTROL 02H 1AH 00H 00H 02H <DATA> CKS
013. VOLUME ADJUST 03H 10H 00H 00H 05H 05H <DATA> CKS
014. BASE MODEL TYPE REQUEST 00H BFH 00H 00H 01H 00H CKS
015. PROJECTOR INFORMATION REQUEST 00H BFH 00H 00H 01H 02H CKS
And also here you got the communication settings:
Baud rate: 19200 bps
Data length: 8 bits
Parity bit: No parity
Stop bits: 1 bit
Communications mode: Full duplex
For the moment I've wroten a few orders:

mscomm1.commport = 1
mscomm1.settings = "19200,n,8,1"
mscomm1.portopen = true
mscomm1.output = "h03 8C 00 00 00 8F"

I don't really know much from vb6, I just started with this project, also controling AOI (automatical optical inspection), few weeks ago with no idea about vb6, neither others.
Can someone help me?

Does no one can helpe me? I hope someone with serial port communication knowledge could help me.

Is this in XP (there has a been a few threads going around about problems with reading/writing serial ports in XP with VB). Also, I'm not sure if the output is supposed to be a string, or if it's supposed to be those values in hex.....

Yes it is in windows XP professional
I've tried more things in the while I have no answer and I've sent the message in different ways

MSComm1.Output = "038C0000008F"
MSComm1.Output = "000000111000110000000000000000000000000010001111"
MSComm1.Output = &H038C0000008F"

but none of them have worked.
Is there anyway to check my port is working properly?

Hi,

Give this a try. Call the PowerOff function from a button_onlclick instead of onload.

mscomm1.RThreshold = 34
mscomm1.commport = 1
mscomm1.settings = "19200,n,8,1"
mscomm1.portopen = true


Public Sub PowerOff()
On Error Resume Next

Dim bytes(5) As Byte

bytes(0) = "&H" & 02
bytes(1) = "&H" & 01
bytes(2) = "&H" & 00
bytes(3) = "&H" & 00
bytes(4) = "&H" & 00
bytes(5) = "&H" & 03

MSComm1.Output = bytes


End Sub

Private Sub MSComm1_OnComm()

On Error Resume Next

If MSComm1.CommEvent = comEvReceive Then

msgbox MSComm1.Input

End If

End Sub

Try using this software to monitor the port "http://www.hhdsoftware.com/Family/serial-monitor.html"


Regards
Marikanna

commented: Well Done +5

SUCCESS. It has worked out. Thanks a lot Marikanna. What is the code alone itself is working propperly, at least the output, with the input doesn't work as I want but I'll make some other tryes to improve it. I think the rest is just working on development and go on, so if I have no other relevant problems I think soon it will be perfectly solved. Thanks once again Marikanna.

Neil

I've tried some other things in my old code and I realise that the clue was just the byte sending.

dim array(n) as byte
 
array (0) = &HXX
array (1) = &HXX
....
array (n-1) = &HXX
array (n) = &HXX
 
MSComm1.Output = array

thanks to anyone that has read and think about my problem, I'm not the best to do it but if someone needs my help I'll be pleased to serve.

Neil

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.