Re: Control device using TTL level signals



Dave wrote:
I want to control an electronic switch that needs a couple of TTL level signals. It is possible to use a Sun for this? I was thinking about programming the parallel port, which has in the past been used in PCs, but I'm not sure how easy it is on a Suns - I have a feeling it is not so easy.

Suns available include a SPARCstation 20, Ultra 60 and Netra T1. Speed is not an issue and I dont mind sticking a transistor on the output if needed.

Dave,

As this is a standard Solaris device, the first place to look is the man page for an open() and associated syscalls.

Assuming that it hasn't been locked by another process (print q, whatever), you should be able to do an open() for a write, then write single bytes to the port. Probably neeed get and set attributes calls as well, to ensure you get raw data and no filtering. Keep a local copy of the current value in your program. 'And' or 'or' to the local copy to set or clear bits, then do a write to the port each time you change the value. You may or may not get the printer strobe pulse as well, which could be uesfull if you want to latch the data externally. It's easy to test this by wiring 8 leds and series resistors across the port lines and gnd to verify that the bits do in fact get set or cleared.

In short, just experiment - you are unlikely to do any damage to anything and should only take a few 10's of minutes to write a quick test program.

The best book for all this stuff is Stevens, "Advanced Programming in the Unix Environment" - well worth the cost and probably cheap s/h on ABE or Amazon...

Chris

----------------------
Greenfield Designs Ltd
Electronic and Embedded System Design
Oxford, England
(44) 1865 750 681
.



Relevant Pages

  • Re: Cant go back to original BIOS on P5KC ?
    ... I use the serial port to load programming to Ham radios and police ... The software used does not like USB serial port dongles. ... is only "safe" if the BIOS tool you ... is *NOT* programming the boot block. ...
    (alt.comp.periphs.mainboard.asus)
  • Windows Service Project
    ... I've started my first practice windows service project in C#, ... there are three key moments which prevent me from programming such ... How do I make the service listen on any port? ... What is the event that is raised, when some query ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Will the real Altair Basic please stand up?
    ... a few programming languages running under CP/M. ... I found the mystery port. ... PIO with terminal on it (I used a SWTP TVT ... Also I think programming system II allowed for the status switches ...
    (comp.os.cpm)
  • Re: Why the C committee doesnt provide an implementation when the standard is published?
    ... I've been programming, in C, since the 70's. ... that people sometimes think I've "cheated" some how on the port. ... the 8051 and Coldfire versions and further development on the Coldfire version. ... The portions where I skip portability are either due to the application ...
    (comp.lang.c)
  • Services, C#
    ... How do I make the service listen on any port? ... What is the event that is raised, when some query actually arrives at that port? ... If necessary and if you can, disregard the existing standard communication protocols, as I will be programming the client side too, so I suppose it doesn't matter what's the format of my response. ...
    (microsoft.public.dotnet.languages.vc)