|
© MCS Electronics, 1995-2007 |
|
|
|
0 |
SOCK_CLOSED |
Connection closed |
1 |
SOCK_ARP |
Standing by for reply after transmitting ARP |
|
|
request |
2 |
SOCK_LISTEN |
Standing by for connection setup to the client when |
|
|
acting in passive mode |
3 |
SOCK_SYNSENT |
Standing by for SYN,ACK after transmitting SYN for |
|
|
connecting setup when acting in active mode |
4 |
SOCK_SYNSENT_ACK |
Connection setup is complete after SYN,ACK is |
|
|
received and ACK is transmitted in active mode |
5 |
SOCK_SYNRECV |
SYN,ACK is being transmitted after receiving SYN |
|
|
from the client in listen state, passive mode |
6 |
SOCK_ESTABLISHED |
Connection setup is complete in active, passive |
|
|
mode |
7 |
SOCK_CLOSE_WAIT |
Connection being terminated |
8 |
SOCK_LAST_ACK |
Connection being terminated |
9 |
SOCK_FIN_WAIT1 |
Connection being terminated |
10 |
SOCK_FIN_WAIT2 |
Connection being terminated |
11 |
SOCK_CLOSING |
Connection being terminated |
12 |
SOCK_TIME_WAIT |
Connection being terminated |
13 |
SOCK_RESET |
Connection being terminated after receiving reset |
|
|
packet from peer. |
14 |
SOCK_INIT |
Socket initializing |
15 |
SOCK_UDP |
Applicable channel is initialized in UDP mode. |
16 |
SOCK_RAW |
Applicable channel is initialized in IP layer RAW |
|
|
mode |
17 |
SOCK_UDP_ARP |
Standing by for reply after transmitting ARP |
|
|
request packet to the destination for UDP |
|
|
transmission |
18 |
SOCK_UDP_DATA |
Data transmission in progress in UDP RAW mode |
19 |
SOCK_RAW_INIT |
W3100A initialized in MAC layer RAW mode |
The SocketStat function is also used internally by the library.
See also
CONFIG TCPIP, GETSOCKET , SOCKETCONNECT, TCPWRITE, TCPWRITESTR, TCPREAD, CLOSESOCKET , SOCKETLISTEN
Partial Example
Tempw = Socketstat(i , 0)' get status
SelectCase Tempw
Case Sock_established
Case Else
EndSelect
SONYSEND
Action
Sends Sony remote IR code.
© MCS Electronics, 1995-2007
Syntax
SONYSEND address [, bits]
Uses
TIMER1
Remarks
Address |
The address of the Sony device. |
bits |
This is an optional parameter. When used, it must be 12, 15 or 20. |
|
Also, when you use this option, the address variable must be of the type |
|
LONG. |
|
|
SONY CD Infrared Remote Control codes (RM-DX55)
Function |
Hex |
Bin |
Power |
A91 |
1010 1001 0001 |
Play |
4D1 |
0100 1101 0001 |
Stop |
1D1 |
0001 1101 0001 |
Pause |
9D1 |
1001 1101 0001 |
Continue |
B91 |
1011 1001 0001 |
Shuffle |
AD1 |
1010 1101 0001 |
Program |
F91 |
1111 1001 0001 |
Disc |
531 |
0101 0011 0001 |
1 |
011 |
0000 0001 0001 |
2 |
811 |
1000 0001 0001 |
3 |
411 |
0100 0001 0001 |
4 |
C11 |
1100 0001 0001 |
5 |
211 |
0010 0001 0001 |
6 |
A11 |
1010 0001 0001 |
7 |
611 |
0110 0001 0001 |
8 |
E11 |
1110 0001 0001 |
9 |
111 |
0001 0001 0001 |
0 |
051 |
0000 0101 0001 |
>10 |
E51 |
1110 0101 0001 |
enter |
D11 |
1101 0001 0001 |
clear |
F11 |
1111 0001 0001 |
repeat |
351 |
0011 0101 0001 |
disc - |
BD1 |
1011 1101 0001 |
disc + |
H7D1 |
0111 1101 0001 |
|<< |
0D1 |
0000 1101 0001 |
>>| |
8D1 |
1000 1101 0001 |
<< |
CD1 |
1100 1101 0001 |
>> |
2D1 |
0010 1101 0001 |
|
|
|
SONY Cassette |
RM-J901) |
|
Deck A |
|
|
stop |
1C1 |
0001 1100 0001 |
© MCS Electronics, 1995-2007
play > |
4C1 |
0100 1100 0001 |
play < |
EC1 |
1110 1100 0001 |
>> |
2C1 |
0010 1100 0001 |
<< |
CC1 |
1100 1100 0001 |
record |
6C1 |
0110 1100 0001 |
pause |
9C1 |
1001 1100 0001 |
Dec B |
|
|
stop |
18E |
0001 1000 1110 |
play > |
58E |
0101 1000 1110 |
play < |
04E |
0000 0100 1110 |
>> |
38E |
0011 1000 1110 |
<< |
D8E |
1101 1000 1110 |
record |
78E |
0111 1000 1110 |
pause |
98E |
1001 1000 1110 |
|
|
|
---[ SONY TV Infrared Remote Control codes (RM-694) ]--------------------------
program + = &H090 : 0000 1001 0000 program - = &H890 : 1000 1001 0000 volume + = &H490 : 0100 1001 0000 volume - = &HC90 : 1100 1001 0000 power = &HA90 : 1010 1001 0000 sound on/off = &H290 : 0010 1001 0000 1 = &H010 : 0000 0001 0000
2 = &H810 : 1000 0001 0000
3 = &H410 : 0100 0001 0000
4 = &HC10 : 1100 0001 0000
5 = &H210 : 0010 0001 0000
6 = &HA10 : 1010 0001 0000
7 = &H610 : 0110 0001 0000
8 = &HE10 : 1110 0001 0000
9 = &H110 : 0001 0001 0000
0 = &H910 : 1001 0001 0000 -/-- = &HB90 : 1011 1001 0000
For more SONY Remote Control info:
http://www.fet.uni-hannover.de/purnhage/
The resistor must be connected to the OC1A pin. In the example a 2313 micro was used. This micro has pin portB.3 connected to OC1A.
Look in a datasheet for the proper pin when used with a different chip.
An IR booster circuit is shown below:
© MCS Electronics, 1995-2007
See also
CONFIG RC5 , GETRC5 , RC5SEND , RC6SEND
Example
'----------------------------------------------------------------------------- |
|
------------ |
: sonysend.bas |
'name |
'copyright |
: (c) 1995-2005, MCS Electronics |
'purpose |
: code based on application note from Ger Langezaal |
'micro |
: AT90S2313 |
'suited for demo |
: yes |
'commercial addon needed |
: no |
'----------------------------------------------------------------------------- |
|
------------ |
|
$regfile = "2313def.dat" |
' specify the used |
micro |
' used crystal |
$crystal = 4000000 |
frequency |
' use baud rate |
$baud = 19200 |
$hwstack = 32 |
' default use 32 |
for the hardware stack |
' default use 10 |
$swstack = 10 |
for the SW stack |
' default use 40 |
$framesize = 40 |
for the frame space |
|
' +5V <---[A Led K]---[220 Ohm]---> Pb.3 for 2313.
'RC5SEND is using TIMER1, no interrupts are used
'The resistor must be connected to the OC1(A) pin , in this case PB.3
Do
Waitms 500
Sonysend &HA90
Loop
End
SOUND
Action
Sends pulses to a port pin.
© MCS Electronics, 1995-2007
Syntax
SOUND pin, duration, pulses
Remarks
Pin |
Any I/O pin such as PORTB.0 etc. |
Duration |
The number of pulses to send. Byte, integer/word or constant. |
Pulses |
The time the pin is pulled low and high. |
|
This is the value for a loop counter. |
|
|
When you connect a speaker or a buzzer to a port pin (see hardware) , you can use the SOUND statement to generate some tones.
The port pin is switched high and low for pulses times. This loop is executed duration times.
The SOUND statement is not intended to generate accurate frequencies. Use a TIMER to do that.
See also
NONE
Example
'----------------------------------------------------------------------------- |
|
------------ |
: sound.bas |
'name |
'copyright |
: (c) 1995-2005, MCS Electronics |
'purpose |
: demo : SOUND |
'micro |
: Mega48 |
'suited for demo |
: yes |
'commercial addon needed |
: no |
'-----------------------------------------------------------------------------
------------
$regfile = "m48def.dat" |
' specify the used |
micro |
' used crystal |
$crystal = 4000000 |
frequency |
' use baud rate |
$baud = 19200 |
$hwstack = 32 |
' default use 32 |
for the hardware stack |
' default use 10 |
$swstack = 10 |
for the SW stack |
' default use 40 |
$framesize = 40 |
for the frame space |
|
Dim Pulses As Word , Periods As Word |
'set variables |
Pulses = 65535 : Periods = 10000 |
Speaker Alias Portb.1 |
'define port pin |
Sound Speaker , Pulses , Periods |
'make some noice |
'note that pulses and periods must have a high value for high XTALS 'sound is only intended to make some noise!
'pulses range from 1-65535 'periods range from 1-65535