[squeak-dev] Question about serial port communication

Víctor C. T. victorct83 at gmail.com
Tue Jun 23 09:06:29 UTC 2009


Sorry but this code didn't work for me, cause I'm on a Mac and it can't get
port numbers, only names. Anyway initialization is not the problem: this
SerialPort2 class uses two methods called *getOption:* and
*setOption:to: *which
get and set these port parameters (baud rate, data bits, flow control...
even handshake settings). Now after starting the program I'm getting default
settings on a transcript window and they seem ok:

1. baud rate: 115200
2. data bits: 8
3. stop bits: 1
4. parity type: 0
5. input flow control type: 0
6. output flow control type: 0

20. DTR: 1
21. RTS: 1
22. CTS: 0
23. DSR: 0
24. CD: 0
25. RI: 0

Then that's not the problem... I guess that the way I'm sending bytecodes
it's not correct, because there's no response from board.

Thanks again :)

El 21 de junio de 2009 14:12, Víctor C. T. <victorct83 at gmail.com> escribió:

> Certainly the class SerialPort2 that I use doesn't have any method with
> these initialization parameters, I didn't realize it... (this is a bit
> embarrassing...) :P
>
> Well, I'll prove your code tomorrow at work. Thanks a lot for your help
> Jon!!!
>
> 2009/6/20 Jon Hylands <jon at huv.com>
>
>> On Sat, 20 Jun 2009 21:39:37 +0200, Víctor C. T. <victorct83 at gmail.com>
>>
>> wrote:
>>
>> > Is it correct? I don't get any error at this point...
>>
>> I don't see any code to specify the # of data bits, # of stop bits, or the
>> parity. Do they default to the "normal" values (8N1)?
>>
>> Also, you need to make sure the port itself is set up without any hardware
>> flow control - I've never used an Arduino, but I assume its providing a
>> USB
>> interface that ends up using an FT232 or something like that.
>>
>> That serial port class is different than the one I use for my robotics
>> stuff. I've attached the serial port class I use, and it is set up like
>> this:
>>
>>        | serialPort baudRate comPortNumber |
>>        baudRate := 115200.
>>        comPortNumber := 2.
>>        serialPort := SerialPort new
>>                baudRate: baudRate;
>>                dataBits: 8;
>>                stopBitsType: 1;
>>                parityType: 0;
>>                yourself.
>>
>>        (serialPort openPort: comPortNumber) isNil
>>                ifTrue: [ ^self error: 'COM port not available' ].
>>
>>        ...
>>        serialPort close.
>>
>> Later,
>> Jon
>>
>> --------------------------------------------------------------
>>   Jon Hylands      Jon at huv.com      http://www.huv.com/jon
>>
>>  Project: Micro Raptor (Small Biped Velociraptor Robot)
>>           http://www.huv.com/blog
>>
>>
>>
>>
>
>
> --
> Víctor
>



-- 
Víctor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090623/31a2abfd/attachment.htm


More information about the Squeak-dev mailing list