addressing serial port? 
Author Message
 addressing serial port?

hi all!
I took Pascal in High School and now i want to use Pascal to program some
robotics that i wish to control via the serial port of an old laptop of
mine. I will be using Turbo Pascal 7 for DOS (unless theres a better pacage,
Borland is what i have) and i want to address the actual pins independantly
and use the voltage across the pins as triggers for actions. is this remotly
posible in pascal? is there a command or way to program a single pin to
'turn on' or 'off'?
Please help i couldnt find any websites that were any help.
thanks all for any thing that you can tell me.



Wed, 18 Jun 1902 08:00:00 GMT  
 addressing serial port?
Hi,


Quote:
> I took Pascal in High School and now i want to use Pascal to program some
> robotics that i wish to control via the serial port of an old laptop of
> mine. I will be using Turbo Pascal 7 for DOS (unless theres a better pacage,
> Borland is what i have) and i want to address the actual pins independantly
> and use the voltage across the pins as triggers for actions.

Then I see no reason for you to use the serial port. As the name
implies, it was constructed for serial I/O, which requires some kind
of UART on the other end. Use the parallel port instead.

Quote:
> is this remotly
> posible in pascal? is there a command or way to program a single pin to
> 'turn on' or 'off'?

Yes, you only have to write it :-) Let's say, your parallel port is at
$378 (a common address, but old notebooks are a chapter for
themselves), then you can set the state of the 8 data lines (pin 2-9)
by writing a byte to this port. A sketch:

   const Par = $378;
   var state : Byte;

   procedure SetBit(BitNum : Byte);  { zero-based }
   begin
      State := State or 1 shl BitNum;
      Port[$378] := State;
   end;

   procedure ClrBit(BitNum : Byte);
   begin
      State := State and not (1 shl BitNum);
      Port[$378] := State;
   end;

   begin
      State := 0;
      :
      :
   end;

And this is pure Pascal!

Quote:
> Please help i couldnt find any websites that were any help.

Try, if it still works, <http://www.senet.com.au/~cpeacock/>

 - Sebastian



Wed, 18 Jun 1902 08:00:00 GMT  
 addressing serial port?
Hi,

Quote:
>> and i want to address the actual pins independantly
>> and use the voltage across the pins as triggers for actions.

I forgot to mention somthing important: Do *not* use the voltage
directly, not even for small circuits. The computer's chipset is not
supposed to supply high currents. Instead, you should always use a
bus driver such as the 74245. This is also not supposed to drive large
circuits, but remember that a laptop chipset may be expensive and hard
to get hold of (if it is replacable at all), while a 74LS245 costs EUR
0.79 at Conrad Electronic and can be put in a socket. In case of an
emergency, the bus driver sacrifices its life to protect the computer.

Experience shows that a 245 can drive a couple of LEDs, but *not* a
motor or something like that. In this case, you will have to use
transistors, possibly in combination with relais.

 - Sebastian



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Accessing port address in pascal

2. Addressing games port?

3. Paralell port addressing

4. port address???

5. address parallel port

6. Comm port addresses and IRQs

7. serial port software

8. serial port routines

9. Programming the Serial Port in D5

10. print to a serial port printer

11. How do I use the serial port

12. serialun.zip Turbo Pascal Object Oriented Serial Port Unit

 

 
Powered by phpBB® Forum Software