Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
149 user(s) are online (133 user(s) are browsing Forums)

Members: 0
Guests: 149

more...

Support us!

Headlines

 
  Register To Post  

Writing to a1serial.device from a script
Just popping in
Just popping in


See User information
OK, here's the plan:
I have a device that connects to the serial port and is controlled by short, plain ASCII strings. I'd like to write a script file to operate this device for a while until I can get around to porting its regular driver software to OS4.
My question is simple. Can anyone here show me how to do this? How do I open it with the required settings, such as 1200 baud 8,n,1, and send a short string from a script.
After every command, the device returns a single character to indicate success or failure. Parsing the return would be nice, but I'll run blind if I have to.
I think it's possible, and probably not too difficult. I just don't remember how I used to do it.

Thank You,
LyleHaze

Go to top
Re: Writing to a1serial.device from a script
Quite a regular
Quite a regular


See User information
@LyleHaze

In a script you can write to SER:. The speed and baud rate are set up by program control, I don't know how to do it from a script.

Note that if you have kernel debug output also going to serial, it will be at the speed set by U-Boot ("baudrate").
The speed etc of SER: may be different.

BTW, I'm using the serial port to control my HF comms RX, although it has a native GUI now. A WeatherFAX decoder is in the process of development.

cheers
tony
Go to top
Re: Writing to a1serial.device from a script
Just popping in
Just popping in


See User information
@tonyw

Thanks.
I had forgotten about the debug output.
I wonder if that will confuse the device that I want to attach? It's an old X-10 controller called "LynX-10".
No longer manufactured, but it sends and receives, so I used to use remotes around the house to trigger other scripts.
Now, I just want to use it as a cyclic timer for watering houseplants.
I dug up the source for the original Amiga drivers. It's all there, but I'm not sure it's worth porting, since the target hardware is no longer available.
Hmm, so I'll add "disabling serial debug" to my list.
Thanks!
Lyle

Go to top
Re: Writing to a1serial.device from a script
Just popping in
Just popping in


See User information
@tonyw

Quote:

In a script you can write to SER:. The speed and baud rate
are set up by program control, I don't know how to do it
from a script.

The speed and baud rate of SER: and SER1: are specified
in their mountlists in Devs:DOSDrivers/.

Its also possible to override that in a script,
see Documentation/port-handler.doc on the OS4Final CD.

Echo >SER1:9600/8N1 "Hello second serial port"

Go to top
Re: Writing to a1serial.device from a script
Just popping in
Just popping in


See User information
@TetiSoft

It took two tries, but it's now working.
BIG thanks for the help.

I can now proceed with my weekend project.

Life is good today.

LyleHaze

Go to top
Re: Writing to a1serial.device from a script
Just can't stay away
Just can't stay away


See User information
@LyleHaze

it would be easier to knock up a small 68k program to do the job in amiblitz eg.

if openfile ("SER:9600/8N1",1)
defaultoutput 1
defaultinput 1
print "command to send"
while rtn$=""
rtn$=edit$(1)
wend
popinput:popoutput
select rtn$
case "0"
print "success"
case "-1"
print "fasiled"
end select
closefile 1

Amiblitz might even have some commands to use serial.device directly...

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: Writing to a1serial.device from a script
Just popping in
Just popping in


See User information
@Severin

Thanks, but I don't have Amiblitz, and I've never used it.
For short projects, I usually avoid new languages.

I wrote a suite of tools to do this with style about ten years ago. They are on Aminet as "ARexX-10.lha". It came as three executables: The "core" application that connected with the device and provided an ARexx hub for any applications that wanted access, a "remote" that simply gave a GUI window that showed activity and allowed control, and finally an app that would launch ARexx scripts when certain events were seen on the X-10 channels.
Taken together, they worked really well. I automated a few homes with them. Unfortunately, they don't seem to work with OS4.
Last night I considered porting them, but I have not yet done ANY ARexx work in OS4, and I'm not sure how same/different it would be. Since the hardware is no longer available, I would probably be developing for an audience of one. I really want to work on this automatic sprinkler system for our vegetable garden, and a script file provides FAR better control than the timers available in the garden store.
So I connected the old X-10 interface, and it works! I've written a script to do "cyclic" watering for the daylight hours.. Now to decide whether I want to use drip irrigation, or go flashy with water fountains flying across the deck and landing in the potted tomato plants. Could be pretty showy!

Tomorrow I'll install the tubing. I'll see what might be done with dancing fountains.

It's all good.
Lyle

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project