Re: Control device using TTL level signals
- From: ChrisQuayle <nospam@xxxxxxxxxxxx>
- Date: Sat, 22 Mar 2008 13:16:32 GMT
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
.
- Follow-Ups:
- Re: Control device using TTL level signals
- From: Dave
- Re: Control device using TTL level signals
- References:
- Control device using TTL level signals
- From: Dave
- Control device using TTL level signals
- Prev by Date: Re: FA (eBay): Lightwave ServerSwitch 8200 8-Port Sun KVM Switch
- Next by Date: Re: Control device using TTL level signals
- Previous by thread: Re: Control device using TTL level signals
- Next by thread: Re: Control device using TTL level signals
- Index(es):
Relevant Pages
|
|