SPI interface


Results 1 to 11 of 11

Thread: SPI interface

Threaded View

  1. #8
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I may of asked this question before, but us there a way of replicating the html code within PBP.

    This is the example from Mikrobasic (apologies to the owners of this forum for listing competitors products)

    [HTML]program home_auto

    include "home_auto_utils"

    dim myMacAddr as byte[6] ' my MAC address
    myIpAddr as byte[4] ' my IP address
    gwIpAddr as byte[4] ' gateway (router) IP address
    ipMask as byte[4] ' network mask (for example : 255.255.255.0)
    dnsIpAddr as byte[4] ' DNS server IP address

    main:
    ADCON1 = 0x0F ' no analog inputs
    CMCON = 0x07 ' turn off comparators

    PORTB.0 = 0
    TRISB.0 = 0 ' set PORTB.B0 as output (rele control pin)

    indexPage =
    "<html><head><title>mikroElektronika</title></head><body>"+
    "<h3 align=center>MikroElektronika Home Automatization System</h3>"+
    "<form name="+Chr(34)+"input"+Chr(34)+" action="+Chr(34)+"/"+Chr(34)+" method="+
    Chr(34)+"get"+Chr(34)+"><table align=center width=200 bgcolor=#4974E2 border=2><tr>"+
    "<td align=center colspan=2><font size=4 color=white><b>Heat Control</b></font>"+
    "</td></tr><tr><td align=center bgcolor=#4974E2><input name="+Chr(34)+"tst1"+
    Chr(34)+" width=60 type="+Chr(34)+"submit"+Chr(34)+" value="+Chr(34)+"ON"+
    Chr(34)+"></td><td align=center bgcolor=#FFFF00><input name="+Chr(34)+"tst2"+
    Chr(34)+" type="+Chr(34)+"submit"+Chr(34)+" value="+Chr(34)+"OFF"+Chr(34)+
    "></td></tr></table></form></body></html>"

    myMacAddr[0] = 0x00 myMacAddr[1] = 0x14 myMacAddr[2] = 0xA5
    myMacAddr[3] = 0x76 myMacAddr[4] = 0x19 myMacAddr[5] = 0x3F

    ipMask[0]=255 ipMask[1]=255 ipMask[2]=255 ipMask[3]=0
    myIpAddr[0]=192 myIpAddr[1]=168 myIpAddr[2]=0 myIpAddr[3]=120
    gwIpAddr[0]=192 gwIpAddr[1]=168 gwIpAddr[2]=0 gwIpAddr[3]=1
    dnsIpAddr[0]=192 dnsIpAddr[1]=168 dnsIpAddr[2]=0 dnsIpAddr[3]=1


    ' starts ENC28J60 with: reset bit on PORTC.F0, CS bit on PORTC.F1,
    ' my MAC & IP address, full duplex
    Spi_Init()
    ' full duplex, CRC + MAC Unicast + MAC Broadcast filtering
    Spi_Ethernet_Init (PORTC, 0, PORTC, 1,
    myMacAddr, myIpAddr, Spi_Ethernet_FULLDUPLEX)

    ' dhcp will not be used here, so use preconfigured addresses
    SPI_Ethernet_confNetwork(ipMask, gwIpAddr, dnsIpAddr)

    while true ' do forever
    SPI_Ethernet_doPacket() ' process incoming Ethernet packets
    wend
    end.[/HTML]

    As you can see the html is contained within quotes (I had to edit this slightly as the forum displayed the page rather than the source code - the complete code is between the HTML tags), but with the heading "indexpage". Can this be replicated in PBP - or is it a case that Mikrobasic is a much higher level language and PBP simply isn't suitable for this sort of functionality ?
    Last edited by malc-c; - 8th January 2011 at 14:10.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts