Page 1 of 1
AmigaOS4 Serial Device Examples
Posted: Wed Dec 23, 2020 9:09 am
by seventhwonder
Dear all
Is it possible to share code snippets for serial device support on AmigaOS4.
Especially writing to serial device and reading the output from serial.device ?
Thank youç
Re: AmigaOS4 Serial Device Examples
Posted: Wed Dec 23, 2020 11:20 am
by plouf
There are some simol examples here
viewtopic.php?p=16047#p16047
Should work in all oses.
However be aware that current version of hollywood uses hardcoded the serial.device. in aos4 more or less you need to use another device (since serial.device is classic amiga internal device)
This is implemented in NEXT version of holywood
Re: AmigaOS4 Serial Device Examples
Posted: Tue Dec 29, 2020 9:13 am
by SMF
The sources for SerialThing helped me when doing my first program in hollywood.
SerialTing can be downloaded from
http://os4depot.net/?function=showfile& ... lthing.lha
The hollywood manual was not so great at describing how to set the baudrate so i struggled quite a lot with that until i looked at the sources for serialthing.
Re: AmigaOS4 Serial Device Examples
Posted: Wed Dec 30, 2020 11:03 pm
by airsoftsoftwair
SMF wrote: ↑Tue Dec 29, 2020 9:13 am
The hollywood manual was not so great at describing how to set the baudrate so i struggled quite a lot with that until i looked at the sources for serialthing.
Really? What was so unclear in the doc? Let me know and I'll try to improve it

Re: AmigaOS4 Serial Device Examples
Posted: Sun Jan 10, 2021 8:34 am
by SMF
airsoftsoftwair wrote: ↑Wed Dec 30, 2020 11:03 pm
SMF wrote: ↑Tue Dec 29, 2020 9:13 am
The hollywood manual was not so great at describing how to set the baudrate so i struggled quite a lot with that until i looked at the sources for serialthing.
Really? What was so unclear in the doc? Let me know and I'll try to improve it
Sorry
I'm not sure if it was an user error or a bug ? :O
I'm a total n00b and have only completed one projekt with hollywood so i'm still learning how to read the manual.
But when setting up the serial connection there are some constants for baud rate etc.
I did struggle with the connection alot and tested everything i could think of.
Hollywod seemed to accept the baudrate i used (#BAUD_38400) but the recieving partner ended up with just garbage.
This made me think that the baudrate was not correctly set.
In the end i found source code for another project that helped me set the baud rate correctly.
So i ended up with this code to set the baud rate to 384000 etc.
Code: Select all
/* Create table for serial communication */
p = {} ; initialize prefs table
p.unit = 1 ; Serial.device unit 1
p.bauds = 5 ; 38400
p.bits = 3 ; 8
p.parity= 0 ; N
p.stop = 0 ; 1
p.flow = 0 ; None
Local t={
Baudrate=p.bauds, ; Serial settings table
DataBits=p.bits,
StopBits=p.stop,
Parity=p.parity,
FlowControl=p.flow
}
sid = OpenSerialPort(1,p.unit,t) ; Open serial port
There was no way that i could understand from the manual that 5 = #BAUD_38400
I have not kept an example of how i did try to set up the connection from the beginning but i was using the #BAUD constant and hollywood seemed to gladly accept it but it did not change the baudrate.
This was on OS4 btw.
Re: AmigaOS4 Serial Device Examples
Posted: Tue Jan 12, 2021 10:33 pm
by airsoftsoftwair
SMF wrote: ↑Sun Jan 10, 2021 8:34 am
There was no way that i could understand from the manual that 5 = #BAUD_38400
But you don't have to know that! Just use the constant instead of its value, i.e.
That's what those constants are actually for ... to make the code more readable because nobody knows what's going on when you do
although it is technically the same as the first code.