Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Toggling a serial port pin on/off?
#1
Hi all. I'm reasonably good at using the serial port, but not sure about this. Is there some basic command that will allow me to toggle an individual serial port pin on and off. I don't care which pin, or whether or not I have to use one command to turn it on and another to turn it off. I also don't mind using peek and poke commands. I just wouldn't know what register to poke.

Thanks all;

Dex

btw - I use QuickBASIC 4.5
Reply
#2
Well, I found at least one solution. Not sure how "proper" this is, but it seems to work. The number 426, in the "for - next" loop was derived at by experimentation to generate a 1ms pulse.

Code:
' Place probe on pin 4 for positive pulse.
' Place probe on pin 7 for negative pulse.
' COM1 = 1016 : COM2 = 760
DEF SEG = 0
c = 760

Start:
  CLS
  LOCATE 10, 10: PRINT "Hit any key to generate pulse."
  LOCATE 12, 10: PRINT "(Hit e to end program.)"
  g$ = INPUT$(1)
  OUT c + 4, 1
  FOR x = 1 TO 426: t = 1: NEXT x
  OUT c + 4, 2
  IF g$ = "e" THEN END
  GOTO Start
  END

This was just tossed together real quick to see if it would work. The final program would be more "elegant". :wink:

Dex
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)