Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucuxc Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!hamilton From: hamilton@uiucuxc.CSO.UIUC.EDU Newsgroups: net.micro.amiga Subject: Re: input from the serial port... Message-ID: <148600016@uiucuxc> Date: Fri, 15-Nov-85 11:22:00 EST Article-I.D.: uiucuxc.148600016 Posted: Fri Nov 15 11:22:00 1985 Date-Received: Sat, 16-Nov-85 21:02:59 EST References: <400@caip.RUTGERS.EDU> Lines: 36 Nf-ID: #R:caip.RUTGERS.EDU:400:uiucuxc:148600016:000:1678 Nf-From: uiucuxc.CSO.UIUC.EDU!hamilton Nov 15 10:22:00 1985 >> I have a friend who is trying to get input from the serial >> port. He has been able to send characters, but not recieve >> them. Any ideas? > Yes if he is using the C compiler... "LATTICE" then he should > be advised that there is a bug with the data element of the > SERIO->IOSer.io_Data. This element must be at least 4 bytes > (a long) and the data (ie the character received from the > serial port) will be in the HI byte of the DATA element. io_Data is a pointer to a buffer, not a buffer itself. the real bug, as was posted recently (for which, much thanx!) involves the C compiler. io_Data is declared an APTR, which is defined: typedef STRPTR *APTR; /* absolute memory pointer */ typedef unsigned char *STRPTR; /* string pointer */ (should be "typedef unsigned char *APTR" or "typedef STRPTR APTR"?) now, if you have in your program: char buf[BUFSIZE]; ... xxx.io_Data = (APTR) &buf[0]; it is possible for the value in io_Data to be, eg, &buf[-3], due to the lattice C bug that truncates some low-order bits. there are several ways to work around this bug: obtain your buffer from malloc, manually align your buffer pointer, or pass your buffer pointer to a function where the formal argument is declared APTR (eliminate the "conversion"). i have a prototype terminal emulator program working that reads from the serial port. i'll post it when i've cleaned it up some and added file transfer capability. wayne hamilton U of Il and US Army Corps of Engineers CERL UUCP: {ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton ARPA: hamilton@uiucuxc.cso.uiuc.edu CSNET: hamilton%uiucuxc@uiuc.csnet USMail: Box 476, Urbana, IL 61801 Phone: (217)333-8703