Post Reply 
Performing arbitrary I/O with the 41CL serial port
06-07-2017, 10:31 PM
Post: #1
Performing arbitrary I/O with the 41CL serial port
Hi all,

I have an application for the 41CL serial port wherein I need to send and receive arbitrary newline-terminated strings. I currently have the 41CL Extreme and PowerCL Extreme modules installed, along with AMC OS/X.

I see there are functions to get and put bytes to a memory buffer, but the get command does not leave the serial character in the X register for comparison with a newline. Likewise there seems to be no way to send a character whose ASCII value is in the X register. But the character at a time approach would be problematic at high baud rates anyway, so maybe another approach?

I could use the YIMP/YEXP commands to transfer a block of characters instead. However, it seems that getting access to the data in the buffer is limited to the YPEEK function which doesn't leave the word in the X register either. Having to decode a hex string in the Alpha register seems an awfully roundabout way to get at the serial data. Is there no other means for a program to use the serial port without resorting to MCODE?

For the curious, the application is a circuit I've breadboarded with a Maxim chip to handle the RS232 interface and an Arduino pro mini to talk to. The Arduino in turn reads and decodes the data from a GPS module, then sends data like longitude & latitude in response to commands sent via RS232. Everything checks out using a USB to RS232 cable, but how to get the 41CL to communicate? It seems the serial port was envisioned for memory block transfers rather than general use.

What, oh what, have I missed! Smile Anyone have a suggestion?

Thanks!
~Mark
Find all posts by this user
Quote this message in a reply
06-08-2017, 01:37 AM
Post: #2
RE: Performing arbitrary I/O with the 41CL serial port
To my knowledge there is no function that do something like send-string or receive-string.

You can YPOKE/YPEEK directly to/from the serial port one byte at the time.
Ref.: NEWT CPU Tech. Manual, newt-v4.pdf, I/O Ports Section, Page: 151 to 154, I/O Port 0xF = UART/SDIO Data Register

Like send the letter 'A' (0x41 ASCII) to the serial output buffer
Code:
"F---0041"
YPOKE

or read the pending character from the serial input buffer
Code:
"F---0000"
YPEEK
"F---00??"  // ?? will be replaced by the hex value of the byte read

If I had to do string line exchange, I would probably use a text file in X-Memory, then transfer the file through the transmit buffer functions.
Unfortunately, I do not have the time to experiment this idea right now, maybe Monte or Angel has a better solution.

Sylvain
Find all posts by this user
Quote this message in a reply
06-08-2017, 02:20 AM
Post: #3
RE: Performing arbitrary I/O with the 41CL serial port
(06-08-2017 01:37 AM)Sylvain Cote Wrote:  If I had to do string line exchange, I would probably use a text file in X-Memory, then transfer the file through the transmit buffer functions.
Unfortunately, I do not have the time to experiment this idea right now, maybe Monte or Angel has a better solution.

Sylvain

Now that's an approach I hadn't considered. I can certainly manipulate the data in a file, and I would want to store the results I read back anyway. I'll play around with the idea.

Thanks Sylvain (and an enhancement hint to Angel!)
~Mark
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)