Dave, Thanks, I was able to file out SerialPort from Squeak into Cuis. I tried this code in a workspace: | port oc | port := (SerialPort new) openPort: 'COM4'.
oc := OrderedCollection new. port nextPutAll: '>01100'. oc add: port readString. oc add: port readString. oc add: port readString. port close. oc
Some data was sent out as indicated by an LED at the connection. Unfortunately, the response was empty strings which is incorrect based on the off shelf software. I tried adjusting the baud rate but that did not help. Any suggestions? Thank you.
Also, I'm interested in hooking the serial port code up to an application window like the original. Can you please point me to a tutorial to learn how? Eventually I want to migrate from simple text response to tables or graphs.
------------------ jinoh67, > "To access IO device, use FFI" sounds like good advice but without more details I can't do it. Can you refer me to a tutorial on using FFI?
Thanks, Kirk Fraser
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Did you set the baud rate before you called openPort: ? All configuration of your SerialPort instance has to be done before opening the device. I know sounds a little non-intuitive but that's how it works. Are you executing each line in your workspace individually, or are you selecting the whole block and hit Ctrl-D? If you run the workspace by selecting all and hit execute it probably will not work. The SerialPort interface is asynchron which means Squeak will probably execute 'port close' before the initial string '>01100' is completely sent - especially if you don't change the baud rate (default is 9600 baud). Have fun, Markus
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Kirk Fraser
On Sun, Feb 26, 2012 at 11:04:17AM -0800, Overcomer Man wrote:
> Dave, > > Thanks, I was able to file out SerialPort from Squeak into Cuis. I tried > this code in a workspace: > > | port oc | > port := (SerialPort new) openPort: 'COM4'. > oc := OrderedCollection new. > port nextPutAll: '>01100'. > oc add: port readString. > oc add: port readString. > oc add: port readString. > port close. > oc > > Some data was sent out as indicated by an LED at the connection. > Unfortunately, the response was empty strings which is incorrect based on > the off shelf software. I tried adjusting the baud rate but that did not > help. Any suggestions? Thank you. > > Also, I'm interested in hooking the serial port code up to an application > window like the original. Can you please point me to a tutorial to learn > how? Eventually I want to migrate from simple text response to tables or > graphs. I'm afraid I have not ever used the serial interface on Squeak, I am only familiar with it because I did some work to fix the plugin once. Your best bet is to ask for help on the squeak-dev list, because a number of people on that list have experience with this. >From your description above (expecially the "blinking light" part), I suspect you are close to having this working, but will need to figure out whatever magic combination of buad rate, parity, etc is required. Usually when working with a serial line protocol, if you can see that data is going out (the blinking light), but the gadget on the other end acts like it never saw any data, it's most likely because some such setting was wrong and the gadget was not able to read whatever you sent. I don't know what's involved in setting the baud rate on a USB serial port on Windows, but some further fiddling with that may help. Try asking on squeak-dev, maybe someone on the list can offer some advice. Dave > > ------------------ > > jinoh67, > > > "To access IO device, use FFI" > sounds like good advice but without more details I can't do it. Can you > refer me to a tutorial on using FFI? > > Thanks, > Kirk Fraser > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |