drwarne
10-05-01, 05:18 PM
Help!
I am an artist using basic robotics for a show in a few weeks. I have been learning forth for the NMIS-21 & 2-NMIS-L-7056's. I have a C program sending position & velocity strings through the serial port to the board. This data is read by a Forth v3.5 loop which converts the strings to values and sets the motors going. This is working just great, but a little slowly. Right now i can send about 20 strings a second, but i am hoping to get at least 30Hz.
By trial & error i have decided that the slow down is likely the routine i am using to convert the strings to numbers:
: INPUT_FROM_SERIAL ( --- d )
KEY 48 - 1000 * 1000 UM*
KEY 48 - 100 * 1000 UM* D+
KEY 48 - 10 * 1000 UM* D+
KEY 48 - 1000 UM* D+
KEY 48 - 100 UM* D+
KEY 48 - 10 UM* D+
KEY 48 - D+
;
This of course converts "1234567" to 1,234,567.
I have read some documentation about NUMBER, FNUMBER & CONVERT, but i am doing something wrong. It might have to do with the fact that i dont quite get where the input is being addressed. Is this a better/faster approach? Can someone please include some code to help me get going?
Thanks a million,
David
I am an artist using basic robotics for a show in a few weeks. I have been learning forth for the NMIS-21 & 2-NMIS-L-7056's. I have a C program sending position & velocity strings through the serial port to the board. This data is read by a Forth v3.5 loop which converts the strings to values and sets the motors going. This is working just great, but a little slowly. Right now i can send about 20 strings a second, but i am hoping to get at least 30Hz.
By trial & error i have decided that the slow down is likely the routine i am using to convert the strings to numbers:
: INPUT_FROM_SERIAL ( --- d )
KEY 48 - 1000 * 1000 UM*
KEY 48 - 100 * 1000 UM* D+
KEY 48 - 10 * 1000 UM* D+
KEY 48 - 1000 UM* D+
KEY 48 - 100 UM* D+
KEY 48 - 10 UM* D+
KEY 48 - D+
;
This of course converts "1234567" to 1,234,567.
I have read some documentation about NUMBER, FNUMBER & CONVERT, but i am doing something wrong. It might have to do with the fact that i dont quite get where the input is being addressed. Is this a better/faster approach? Can someone please include some code to help me get going?
Thanks a million,
David