vba code for a seriel port

  • Thread starter Thread starter Scott T Mc Bride
  • Start date Start date
S

Scott T Mc Bride

what i need to do is open a com port lets say comm1 and send a signal out
on some pin number (doesnt matter) for approximatly 5 seconds then close the
comport

im currently useing this for my code

Open "Com1:9600,n,8,1" For Output As #1

Print #1, xxxxxxxxxxxxxxxxxxnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Close #1

but it only open the port and sends a signal for about 1/3 of a second
I have tried slowing the port down but still no luck


Scott
 
What exactly do you mean by "Send a signal" ? The comm port sends whatever
you print to it, for as long as it takes to send those characters. So the
Transmit line toggles up and down, and the DSR and CTS lines change state
for the duration of the transmission. If you want to make that happen for
longer, send a longer string, or figure out how to use code to explicitly
change the state of the handshake lines. This is not trivial, especially on
Win2000/NT/XP machines.

If for instance you set 300 baud, you will get about 30 characters per
second, so send 150 characters in the string for a 5 second signal.
--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
Back
Top