About me

I'm in Poland


  • KeinXor has started 3 topics. 8 people are following them.
  • KeinXor has made 16 replies. They have been marked useful a total of 1 time.

Recent activity

Subscribe to this feed
  • question

    ezuk replied on October 01, 2008 10:32 to the question "Help!" in Tibbo:

    ezuk
    No such info at this time.
  • question
  • question

    Michel Schonmeier replied on September 26, 2008 20:45 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    Michel Schonmeier
    hmm..i discovered my error =P then not acept other connection if already he are connected in server....

    Thanks KeinXor!!
  • question

    KeinXor replied on September 26, 2008 20:14 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    KeinXor
    Yes,
    but you did not notice that I passed in code which he does not have sock.varbuffrq(2)... ;]
  • question

    Michel Schonmeier replied on September 26, 2008 19:47 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    Michel Schonmeier
    Hmm.. my code already have sys.buffalloc after of my TCP config function...
    and my error "Asynchronouss socket error 10053" continue =/
  • question

    KeinXor replied on September 26, 2008 19:23 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    KeinXor
    Hello,
    this code is working:

    sock.num = SOCKET_HTTP
    sock.rxbuffrq(1)
    sock.txbuffrq(1)
    sock.varbuffrq(1)
    sock.protocol = PL_SOCK_PROTOCOL_TCP
    sock.httpmode = YES
    sock.inconmode = PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
    sock.httpportlist = "80"

    sock.num = SOCKET_TCP
    sock.rxbuffrq(2)
    sock.txbuffrq(2)
    sock.protocol=PL_SOCK_PROTOCOL_TCP
    sock.localportlist="8000"
    sock.inconmode=PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
    sys.buffalloc
  • question

    Michel Schonmeier replied on September 26, 2008 18:28 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    Michel Schonmeier
    Hello,

    I too using Tsocket component to receive but now i go use for send and now he go connect then send error "Asynchronouss socket error 10053".

    My socket config:
    socket_http=1 and socket_tcp=2



    sock.num = SOCKET_HTTP

    sock.rxbuffrq(1)
    sock.txbuffrq(1)
    sock.varbuffrq(1)

    sock.protocol = PL_SOCK_PROTOCOL_TCP
    sock.httpmode = YES
    sock.inconmode = PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
    sock.httpportlist = "80"

    sock.num = SOCKET_TCP

    sock.rxbuffrq(2)
    sock.txbuffrq(2)
    sock.varbuffrq(2)

    sock.protocol = PL_SOCK_PROTOCOL_TCP
    sock.reconmode = PL_SOCK_RECONMODE_1
    sock.httpmode = NO
    sock.inconmode = PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
    sock.localportlist = "8000"



    Have error in this code??

    Thanks
  • question

    KeinXor replied on September 24, 2008 21:13 to the question "Someone utilizing interface EM-1000+ Delphi??" in Tibbo:

    KeinXor
    hello,
    I am using delphi with em1000 and em1202, in my aplication using TClientSocket component/class.
  • question

    KeinXor replied on September 08, 2008 13:28 to the question "does anyone have any DNS code please" in Tibbo:

    KeinXor
    DNS.tbs

    include "global.tbh"

    public dim sNameServerIP as string 'Name Server IP
    dim wID as word
    dim sOPCode as string(4) '0 = standard query, 1 = inverse query, 2 = server status request
    dim sRD as string(1) 'recursion desired
    dim wQDCount as word 'number of questions
    dim wQType as word 'query type
    dim wQClass as word 'query class
    public dim bAnsCount as byte 'number of answers

    'query type
    '+-----------------------+
    '| Value | Description |
    '+-------+---------------+
    '| 1 |IP Address |
    '| 2 |Name Server |
    '| 5 |Canonical name |
    '| 12 |pointer record |
    '| 13 |host info |
    '| 15 |mail exchange |
    '+-------+---------------+

    dim sQuestion as string 'the question(domain name) in DNS format
    dim sIPString as string 'contains all ip addresses mapped to the domain name in question.
    '---------------------------------------------------------------------------------------
    'Extract IPs from the response strings in the sock rx buffer, and store all IPs in the sIPString
    'Also return the result of the query.
    public function ExtractFromRXBuff as byte
    dim bPos as byte
    dim i as byte
    dim sIPStart as string
    dim sTemp as string
    dim bFlag as byte
    dim bRCode as byte
    dim sAns1 as string
    dim sAns2 as string
    dim sTempIP as string
    sock.num = 0
    sAns1 = sock.getdata(255)
    sAns2 = sock.getdata(255) 'the response string is longer than 255
    sIPStart = chr(0) + chr(1) + chr(0) + chr(1) '0001 0001 IP Address Answer
    bPos = instr(1,sAns1,sQuestion,1) 'the position of the question(Domain Name) in the respond packet
    bAnsCount = asc(mid(sAns1,bPos-5,1)) 'the number of answers
    bFlag = asc(mid(sAns1,bPos-9,1)) 'extracting the query result "RCode" from the flag
    bRCode = val("&b" + right(bin(bFlag),4))
    bPos = bPos + len(sQuestion) + 5
    'bPos = instr(bPos,sAns1,sIPStart,1) 'the position of first IP Address Answer
    if len(sAns2) > 0 then
    sTemp = right(sAns1,len(sAns1)-bPos) + left(sAns2,bPos) 'locating the part of response that contains IPs
    else
    sTemp = right(sAns1,len(sAns1)-bPos)
    end if
    for i = 1 to bAnsCount
    dim sIP as string
    dim bIPLen as byte
    bPos = instr(1,sTemp,sIPStart,i) + 9
    bIPLen = asc(mid(sTemp,bPos,1))
    sTempIP = sTempIP + str(i) + ":" + mid(sTemp,bPos,bIPLen + 1)
    next i
    sIPString = sTempIP
    ExtractFromRXBuff = str(bRCode) 'bRCode: 0:no error, 2:server fail, 3:name error
    end function
    '---------------------------------------------------------------------------------------
    'initialize DNS connection, and set the default value
    public sub InitDNS
    wID = 1
    sOPCode = "0000"
    sRD = "1"
    wQDCount = 1
    wQType = 1
    wQClass = 1
    sock.num = 0
    sock.txbuffrq(2)
    sock.rxbuffrq(4)
    sys.buffalloc
    sock.protocol = PL_SOCK_PROTOCOL_UDP
    sock.inconmode = PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
    sock.reconmode=PL_SOCK_RECONMODE_3
    sock.targetip = sNameServerIP
    sock.targetport = 53
    sock.connect
    end sub
    '---------------------------------------------------------------------------------------
    'convert sTemp into binary string, padding the 0 and add to the sDNSQuery string
    function BinaryConverter(sTemp as string, sDNSQuery as string) as string
    sTemp = right(sTemp,len(sTemp) - 2)
    do while len(sTemp) < 16
    sTemp = "0" + sTemp
    loop
    BinaryConverter = sDNSQuery + chr(val("&b"+ left(sTemp,8))) + chr(val("&b"+ right(sTemp,8)))
    end function
    '---------------------------------------------------------------------------------------
    'form the DNS query string and send the query to DNS server
    public function Query(sQueryName as string) as string
    dim sDNSQuery as string
    dim sQFlag as string
    dim i as byte
    dim sTemp as string
    sDNSQuery = BinaryConverter(bin(wID),sDNSQuery)
    sQFlag = "0"+ sOPCode + "00" + sRD + "00000000"
    sDNSQuery = sDNSQuery + chr(val("&b"+ left(sQFlag,8))) + chr(val("&b"+ right(sQFlag,8)))
    sDNSQuery = BinaryConverter(bin(wQDCount),sDNSQuery)
    sDNSQuery = sDNSQuery + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) + chr (0)
    sQueryName = sQueryName + "."
    do while instr(1,sQueryName,".",1) > 0
    dim bPos as byte
    bPos = instr(1,sQueryName,".",1)
    sTemp = sTemp + chr(bPos-1) + left(sQueryName, bPos-1)
    sQueryName = right(sQueryName, len(sQueryName)-bPos)
    loop
    sQuestion = sTemp
    sDNSQuery = sDNSQuery + sQuestion + chr(0)
    sDNSQuery = BinaryConverter(bin(wQType),sDNSQuery)
    sDNSQuery = BinaryConverter(bin(wQClass),sDNSQuery)
    sock.num = 0
    sock.setdata(sDNSQuery)
    sock.send
    Query = sDNSQuery
    end function
    '---------------------------------------------------------------------------------------
    'return the IP address according the index, in string format. (there can be many IP mapped
    'to one domain name.
    public function ConvertToIPString(bIndex as byte) as string
    dim sTemp as string
    dim bIPLen as byte
    dim bPos as byte
    if bIndex > bAnsCount then
    bIndex = 1
    end if
    bPos = instr(1,sIPString,str(bIndex)+":",1)
    bIPLen = asc(mid(sIPString,bPos + 2,1))
    sTemp = mid(sIPString,bPos+3,bIPLen)
    ConvertToIPString = ddstr(sTemp)
    end function
  • question

    KeinXor replied on September 08, 2008 13:27 to the question "does anyone have any DNS code please" in Tibbo:

    KeinXor
    global.tbh

    declare sNameServerIP as string
    declare bAnsCount as byte
    declare sub InitDNS
    declare function Query(sQueryName as string) as string
    declare function ExtractFromRXBuff as byte
    declare function ConvertToIPString(bIndex as byte) as string
  • question

    KeinXor replied on September 08, 2008 13:20 to the question "does anyone have any DNS code please" in Tibbo:

    KeinXor
    Hello,
    I hope that this code will help you:
    main.tbs

    include "global.tbh"

    sub on_sys_init
    'set IP address
    net.gatewayip = "192.168.1.1"
    net.netmask = "255.255.255.0"
    net.ip = "192.168.1.105"
    sNameServerIP = "168.95.1.1"
    InitDNS
    end sub

    sub on_sock_data_arrival
    dim s as byte
    dim k1 as string
    dim k2 as string
    dim k3 as string
    dim k4 as string
    dim k5 as string
    s = ExtractFromRXBuff
    k1 = ConvertToIPString(1)
    k2 = ConvertToIPString(2)
    k3 = ConvertToIPString(3)
    k4 = ConvertToIPString(4)
    k5 = ConvertToIPString(5)
    end sub

    sub on_button_pressed
    if sock.statesimple = PL_SSTS_EST then
    Query("www.yahoo.com")
    end if
    end sub
  • question

    viron replied on September 04, 2008 08:41 to the question "talk to I2C device" in Tibbo:

    viron
    Hi,
    The DS2480B is a rs-232 to 1-wire protocol chip that can interface to 1-wire network.

    Regards,
    Viron.
  • KeinXor started following the question "Help!" in Tibbo.

  • star

    ezuk marked one of KeinXor's replies in Tibbo as useful. KeinXor replied to the question "talk to I2C device".

  • question

    A comment on the question "talk to I2C device" in Tibbo:

    markb
    thank you very much. this will do nicely. I was hoping there was an 'in-built' fuction rather than hand-coded solution in basic.. – markb, on August 31, 2008 00:21
  • question

    KeinXor replied on August 30, 2008 14:54 to the question "talk to I2C device" in Tibbo:

    KeinXor
    hello,
    in module EM1000 is real-time clock.
    To communicate with I2C procedure:
    i2c.tbh

    '------------------------------------------------------------------------------
    'Enumerations

    '------------------------------------------------------------------------------
    'Global variables

    '------------------------------------------------------------------------------
    'Pins definition
    const SDA= PL_IO_NUM_4_RTS
    const SCL= PL_IO_NUM_5
    '------------------------------------------------------------------------------
    'Function/Subrutines declaration

    declare function StoreIP(byref IP as string)as byte
    declare sub RestoreIP()



    i2c.tbs


    include "I2C.tbh"

    '------------------------------------------------------------------------------
    'Enumerations

    '------------------------------------------------------------------------------
    'Global variables

    '------------------------------------------------------------------------------
    'Pins definition

    const IP_DATA_LNG= 3 'Lenght of binary IP data (0-3)
    const IP_EE_ADD= 0 'Address in external EEPROM
    const EE_ADD= &hA0 'EEPROM hardware address (24C01...24C1025)
    '------------------------------------------------------------------------------
    'Function/Subrutines declaration

    declare sub I2C_Putc(x as byte)
    declare function I2C_Getc()as byte
    declare sub I2C_Start
    declare sub I2C_Stop
    declare sub I2C_Ack
    declare sub I2C_Nack

    '******************************************************************************
    'Store IP in external EEPROM
    '******************************************************************************
    public function StoreIP(byref IP as string)as byte

    dim IP_bin as byte 'IP binary data
    dim cnt as byte 'GP counter
    dim ReadData as byte 'Data read back from EEPROM

    for cnt = 0 to IP_DATA_LNG 'Write 4 binary IP bytes

    'Store one byte data to external EEPROM
    '---------------------------------------------------------------------
    IP_bin = asc(mid(IP,1 + cnt,1)) 'Convert singer character to binary data
    I2C_Start 'Process I2C start frame
    I2C_Putc(EE_ADD) '24Cxxx HW address + WRITE
    I2C_Putc(IP_EE_ADD + cnt) '24Cxxx memory address
    I2C_Putc(IP_bin) 'Send data to I2C device
    I2C_Stop 'Terminate I2C writting (I2C stop frame)

    'Read back the stored data back
    '---------------------------------------------------------------------
    I2C_Start 'Process I2C start frame
    I2C_Putc(&b10100000) 'Chip and region Address+WRITE
    I2C_Putc(IP_EE_ADD + cnt) 'Memory address
    I2C_Start 'Process I2C start(or restart) frame
    I2C_Putc(EE_ADD + 1) '24Cxxx HW address + READ
    ReadData = I2C_Getc 'Get data from I2C device
    I2C_Nack 'Terminate read procedure (I2C NACK frame)
    I2C_Stop 'Terminate I2C reading (I2C stop frame)

    'Check if the data was written correctly
    '---------------------------------------------------------------------
    if(IP_bin <> ReadData) then 'Check for correct writtnig
    StoreIP = 0 'Write in EEPROM error
    exit function
    end if
    next cnt
    StoreIP = 1 'Write to ext. EEPROM was OK

    end function
    '******************************************************************************
    'Update IP value from external EEPROM and save it in "net.ip" proprety
    '******************************************************************************
    public sub RestoreIP

    dim cnt as byte 'GP counter
    dim IP_bin as byte 'IP binary data
    dim IP_str as string(5) 'IP string data + NULL character??

    for cnt = 0 to IP_DATA_LNG 'Read 4 binary IP bytes
    I2C_Start 'Process I2C start frame
    I2C_Putc(&b10100000) '24Cxxx HW address + READ
    I2C_Putc(IP_EE_ADD + cnt) 'Memory address
    I2C_Start 'Process I2C start(or restart) frame
    I2C_Putc(EE_ADD + 1) 'Chip and region Address+READ
    IP_bin = I2C_Getc 'Get data from I2C device
    I2C_Nack 'Terminate read procedure (I2C NACK frame)
    I2C_Stop 'Terminate I2C reading (I2C stop frame)
    IP_str = IP_str + chr(IP_bin) 'Concatenate IP string data(reconstruct...)
    next cnt
    net.ip = ddstr(IP_str) 'Store IP addres to "net.ip" proprety

    end sub
    '******************************************************************************
    'I2C Put char subrutine
    '******************************************************************************
    sub I2C_Putc(vData as byte)

    dim bitCnt as byte 'Bits counter
    dim CompVal as byte 'Value to compare - MASK
    dim BitData as boolean 'Comparison result (1 or 0)

    io.num = SCL 'Initialize the transmition
    io.state = LOW
    bitCnt = 0 'Initialize the bits counter
    CompVal = &h80 'Initialize the MASK
    do until bitCnt = 8 '1 byte has 8 bits...
    io.num = SDA 'Select SDA line
    BitData = vData AND CompVal 'Define the state of the bit(MSB-->LSB)
    if(BitData) then
    io.state = HIGH 'Bit is 1
    else
    io.state = LOW 'Bit is 0
    end if
    io.num = SCL 'Write the bit to I2C device
    io.state = HIGH
    io.state = LOW
    bitCnt = BitCnt + 1 'Increment bit counter(next bit)
    CompVal = CompVal / 2 'Move the comparision to the next bit(MSB-->LSB)
    loop
    io.num = SDA 'Emulate the ACK frame
    io.state = HIGH
    io.num = SCL
    io.state = HIGH
    io.state = LOW

    end sub
    '******************************************************************************
    'I2C Get char function
    '******************************************************************************
    function I2C_getc as byte

    dim bitCnt as byte 'Bit counter
    dim CompVal as byte 'Value to compare - MASK

    io.num = SCL 'Initialize the reception
    io.state = LOW
    io.num = SDA
    io.state = HIGH
    bitCnt = 0 'Initialize the bits counter
    CompVal = &h80 'Initialize the MASK
    I2C_Getc = 0 'Initialize the received data
    do until bitCnt = 8 '1 byte has 8 bits...
    io.num = SCL
    io.state = HIGH 'Read one bit from I2C device
    io.num = SDA
    if(io.state = HIGH) then 'Devine the state of the bit
    I2C_Getc = I2C_Getc OR CompVal 'Store the value of the bit
    end if
    bitCnt = bitCnt + 1 'Increment bit counter(next bit)
    CompVal = CompVal / 2 'Move the comparision to the next bit(MSB-->LSB)
    io.num = SCL
    io.state = LOW 'Clear the clock line (the data can change now...)
    loop

    end function
    '******************************************************************************
    'I2C Start frame
    '******************************************************************************
    sub I2C_Start

    io.num = SCL
    io.state = HIGH 'Set SCL line
    io.num = SDA
    io.state = HIGH 'Set SDA line
    io.state = LOW 'Clear SDA line
    io.num = SCL
    io.state = LOW 'Clear SCL line

    end sub
    '******************************************************************************
    'I2C Stop frame
    '******************************************************************************
    sub I2C_Stop

    io.num = SDA
    io.state = LOW 'Clear SDA line
    io.num = SCL
    io.state = HIGH 'Set SCL line
    io.num = SDA
    io.state = HIGH 'Set SDA line
    io.num = SCL
    io.state = HIGH 'Set SCL line

    end sub
    '******************************************************************************
    'I2C ACK frame
    '******************************************************************************
    sub I2C_Ack

    io.num = SCL
    io.state = LOW 'Clear SCL line
    io.num = SDA
    io.state = LOW 'Clear SDA line
    io.num = SCL
    io.state = HIGH 'Set SCL line
    io.state = LOW 'Clear SCL line

    end sub
    '******************************************************************************
    'I2C NACK frame
    '******************************************************************************
    sub I2C_Nack

    io.num = SCL
    io.state = LOW 'Clear SCL line
    io.num = SDA
    io.state = HIGH 'Set SDA line
    io.num = SCL
    io.state = HIGH 'Set SCL line
    io.state = LOW 'Clear SCL line

    end sub

  • question

    T-bone replied on August 12, 2008 06:18 to the question "Schematyc diagram of development boards" in Tibbo:

    T-bone
    Please contact the technical support at Tibbo for schematic diagrams, as far as I know this info is not posted publicly.
  • question

    KeinXor replied on August 11, 2008 19:14 to the question "Schematyc diagram of development boards" in Tibbo:

    KeinXor
    Why the subject stays without the answer by Official Rep / Employee or maybe this secret ?
  • problem

    T-bone replied on August 08, 2008 01:04 to the problem "Where are the demo programs?" in Tibbo:

    T-bone
    Just to clarify, the page is still reachable from the main Taiko page. The "Downloads" link on the left hand side links to software, documentation and demo.

    Also, There's a section on the main page that have links to the demos directly named "Demos".
  • problem
next » « previous