Thanks Dennis for the example code. All the system/c-interface calls are for BSD and thus not usable on linux. However the example is full of how-to's and as such might help.
What I notice with the three examples of code so far is that all of the examples had to define their own system library calls. You used the c-function calls to create your library of system/stdC routines. That seems a bit strange, as in gforth 6, we can open and write to files, even those that are actually serial ports or USB to serial converters. In Unix, you are not really suppose to know whether a file is I/O or just a regular file - the system calls handle the actual work behind the calls as it were. So I guess it gets back to the original problem, which is why is select broken, or just broken for the serial I/O part of reading and writing to a file. It just doesn't make sense that we need to re-do all the system calls for something that did work. Bill. On 03/22/12 20:05, Dennis Ruffer wrote:
Bill, I haven't actually used serial in gforth in the last 5 years, and Forth has become a background hobby for me, at this point. The best I can do is guess and give you some generic guidance. You would have to setup a prompting system if that is what you want. I've always tending to use hard coded settings for that very reason. It looks like there is some kind of translation from COMx to /dev/ttyx, but I don't remember enough about how I got around that. I've attached some old code that I had working 5 years ago on a Mac. It may help or it may just confuse you some more. Either way, I no longer even own a Mac to figure out how to make it work today (;e.g. absolutely no warranty implied or inferred;). Good luck. DaR -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of kibler Sent: Thursday, March 22, 2012 3:25 PM To: [email protected] Subject: Re: [gforth] problem with gforth7 and serial access the "test" works fine - but serial is still dead. Now all we need to do is change the "do this" line in the terminal.fs to match. from terminal.fs \ examples of using terminal: \ \ COM2 B9600 c" 8N1" terminal ( terminal on com2 at 9600 baud, 8N1 ) \ COM1 B57600 c" E71" terminal ( terminal on com1 at 57.6 Kbaud, 7E1 ) Any idea how to change one of the parameters from a prompt? Another question that I keep forgetting, how do we change from /dev/ttyS0 to /dev/ttyUSB0? Does it even work on USB converters? Bill.
