السلام عليكم
انا اقوم بعمل برنامج اتصال سريال من الكمبيوتر بالميكرو كنترولر
و لكن لا استطيع استنتاج Baudmode
The Baudmode argument for SerIn accepts a 16-bit value that determines its characteristics: 1-stop bit, 8-data bits/no-parity or 7-data bits/even-parity and virtually any speed from as low as 300 baud to greater than 38K baud (depending on the crystal frequency used). The list below shows how Baudmode is calculated, see manual for some common baudmodes for standard serial baud rates.
Determine the bit period. (bits 0 - 11) (1,000,000 / baud rate) - 20
Data bits and parity. (bit 13) 8-bit/no-parity = step 1 + 0. 7-bit/even-parity = step 1 + 8192
Select polarity. (bit 14) True (noninverted) = step 2 + 0. Inverted = step 2 + 16384
Add the results of steps 1, 2 3, and 3 to determine the correct value for the Baudmode operator.
If communications are with existing software or hardware, its speed and mode will determine the choice of baud rate and mode. In general, 7-bit/even-parity (7E) mode is used for text, and 8-bit/no-parity (8N) for byte-oriented data. Note: the most common mode is 8-bit/no-parity, even when the data transmitted is just text. Most devices that use a 7-bit data mode do so in order to take advantage of the parity feature. Parity can detect some communication errors, but to use it you lose one data bit. This means that incoming data bytes transferred in 7E (even-parity) mode can only represent values from 0 to 127, rather than the 0 to 255 of 8N (no-parity) mode.
و لكن لا استطيع حسابه
علما باني استخدم بيانات الاتصال كالتالي
و ايضا كود البرمجه كالتالي
كود:
Device=16F877A
XTAL 4
Output PORTB
Dim code Str
PORTB=0
main:
SerIn PORTC.7 , ??????? , 2000 , main , [in]
If in= "L" Then
PORTB=%00000011
End If
If code= "S" Then
PORTB=%00001100
End If
If code= "R" Then
PORTB=%00001010
End If
GoTo main
و لكم جزيل الشكر و التقدير