Additional library for MikroBasic PRO 2009

General discussion on mikroBasic PRO for PIC.
Author
Message
cdunkel
Posts: 42
Joined: 13 Sep 2005 06:18
Location: Switzerland

#31 Post by cdunkel » 09 Nov 2009 00:35

Hello,
one question about the sensirion sht library. I tried it with a PIC18F6722. But unfortunately I get no data from the sensor...
10k pullup resistor is there. When I meassure the data and clock line I get no signal...

What I`m doing wrong?

Code: Select all

program SHT_Test

include sensirion_lib_P18

dim  SHTxx_SDA as sbit at RA5_bit
     SHTxx_SDA_dir as sbit at TRISA5_bit
     SHTxx_SCLK as sbit at RA4_bit
     SHTxx_SCLK_dir as sbit at TRISA4_bit

dim  NoError as boolean
     temperature, humidity as float
     temperature_d, humidity_d as integer
     lcd_txt as string[20]


main:

OSCCON      = %01110000
ADCON1      = %11111111

UART2_Init(19200)
Sensirion_init()

while true

NoError = sensirion_get_temp_hum_dec(temperature_d, humidity_d)

if NoError then
        lcd_txt = "Temperature         "
        UART2_Write_Text(lcd_txt)
        IntToStr(temperature_d, lcd_txt)
        StrCat(lcd_txt, " C")
        UART2_Write_Text(lcd_txt)
        lcd_txt = "Humidity            "
        UART2_Write_Text(lcd_txt)
        IntToStr(humidity_d, lcd_txt)
        StrCat(lcd_txt, " %")
        UART2_Write_Text(lcd_txt)
else
   lcd_txt = "ERROR READING SHTxx "
   UART2_Write_Text(lcd_txt)
end if

delay_ms(4000)

wend
end.
Any help would be great! Thank you.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#32 Post by yo2lio » 09 Nov 2009 09:19

Code: Select all

ADCON1 = %00001111
T0CON = 0
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

Http Server

#33 Post by stevenindon » 12 Dec 2009 09:02

Florin,

I have bee playing around with the ethernet server library and was just wondering the codes below :

Code: Select all

sub procedure HTTPProcDataIn(dim len_ as word, dim j as byte)
    dim i as byte
    dim getRequest,txt31 as string[32]
Can we increase the number of bytes request from user?
I tried increasing dim getRequest as string[32] to dim getRequest as string[100] and when i request from my server :

http://192.168.0.202/Here goes my long text file posted on my embedded web server

The server keeps requesting non stop... and shows no result. It works only when i posted something less than 32 bytes.

Where can i enchance this to send long bytes?.. I would like to process a user form with lng bytes.


Thanks.

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#34 Post by stevenindon » 12 Dec 2009 13:25

Florin,

Sorry it was my mistake. The keeps requesting non stop from to server is due to the wrong byte len that i pass in to Socket.Stop_addr :

Socket[j].Stop_addr = @getRequest + strlen(getRequest)

I have increases the getRequest[32] to getRequest[200] and it still works.

Thanks

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#35 Post by stevenindon » 21 Dec 2009 20:42

Florin,

Recently I have been playing with the your lib1_enc28j60_V3_5 and lib2_enc28j60_V3_5. I successfully built webserver with it. Now i am working on a project building ETH client using yr library. Everything was fine until i hook up a 4X16 LCD display on PortB.

LCD pins config :

Code: Select all

dim LCD_RS as sbit at RB6_bit
    LCD_EN as sbit at RB7_bit
    LCD_D4 as sbit at RB5_bit
    LCD_D5 as sbit at RB4_bit
    LCD_D6 as sbit at RB3_bit
    LCD_D7 as sbit at RB2_bit
    LCD_RS_Direction as sbit at TRISB6_bit
    LCD_EN_Direction as sbit at TRISB7_bit
    LCD_D4_Direction as sbit at TRISB5_bit
    LCD_D5_Direction as sbit at TRISB4_bit
    LCD_D6_Direction as sbit at TRISB3_bit
    LCD_D7_Direction as sbit at TRISB2_bit
Once i run the client unit, I noticed my ethernet module keeps resetting... and i can see that the network icon on my PC keeps connected and disconnected from my ethernet module.

What may be the cost of this problem? I dont know where to start trouble shoot. When I disable my LCD codes, everyting works fine.


Thanks

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#36 Post by stevenindon » 23 Dec 2009 10:42

Florin,

False alarm again... After i changed my MCU, Everything works just fine. I guess there is something wrong ith the MCU.


Thanks and sorry for the false alarm again.

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#37 Post by stevenindon » 27 Dec 2009 18:34

Florin,

I have been using lib1_enc28j60_V3_5 and lib2_enc28j60_V3_5 libraries to build a client requesting web content from my web server and below are my codes.

Code: Select all

'*********************************************************
'INCOMING TCP DATA
'*********************************************************
sub procedure Eth_UserTCP(dim byref dest_ip_addr_T as IpHeader, dim byref source_port_T, dest_port_T, len_T as word, dim CC_Sock as byte)
      dim strInData as string[500]
      if len_T > 512 then len_T = 512 end if
          if source_port_T = MY_TCP_Port then
             memset(@getRequest,0,512)    '<---- Clear getRequest variable
             CopyEthMem_CPToRam(@getRequest,len_T)
             memcpy(@strInData,@getRequest+266,500)
             ProcessData(strInData)
        end if
end sub
I was wondering how can i capture/read data more than 1000 bytes per chunk as i noticed that the buffer on the libraries limits 500+ bytes of transfer each time (len_T - max is approx 500+ then reset to 0 again)

I dont think there is anyway to configure the webserver (IIS) to transfer 512 bytes at a time on 1 single web page.

Please help.

Thanks

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#38 Post by yo2lio » 14 Jan 2010 14:11

All libraries updated.

In Ethernet library hardware check sum is not used any more, this according with ERRATA.

Enjoy!
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#39 Post by stevenindon » 15 Jan 2010 16:51

Florin,

Sorry.. I dont quite understand the checksum thing.
My project is to create a http client that links to a web server...and request information via http protocol:

PIC->sends:

Code: Select all

strHead="GET /index.htm HTTP/1.0"+chr(13)+chr(10)+chr(13)+chr(10)
Send_TCP(DESP_IP_Addr, DEST_TCP_Port, strlen(strHead), strHead)
 
WebServer->Replies-1,000 bytes of data (with http headers)

PIC->Recieved data and copy from EthMem:

Code: Select all

CopyEthMem_CPToRam(@getRequest,len_T)
How can i capture the 1,000 bytes when len_T always reaches max 526 only?

Please help

:(

Easyrider
Posts: 44
Joined: 15 Dec 2009 01:18
Location: Tallinn, Estonia
Contact:

#40 Post by Easyrider » 19 Jan 2010 16:35

yo2lio wrote:New version available.

Additional library for MikroBasic PRO 2009 are available here :
http://www.microelemente.ro/MikroBasic/ ... y_V1_4.zip
Does it support USB for 18F13K50/14K50? It is a universal low-cost mcu with usb. That is all what I need to be happy. But unfortunatly pic basic pro v3.2 does not support USB for this mcu. I installed this library and nothing happens. Help me some one please.
Sorry for my english!

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#41 Post by yo2lio » 19 Jan 2010 21:04

Easyrider wrote:
yo2lio wrote:New version available.

Additional library for MikroBasic PRO 2009 are available here :
http://www.microelemente.ro/MikroBasic/ ... y_V1_4.zip
Does it support USB for 18F13K50/14K50? It is a universal low-cost mcu with usb. That is all what I need to be happy. But unfortunatly pic basic pro v3.2 does not support USB for this mcu. I installed this library and nothing happens. Help me some one please.
No, sorry, I don't have support for USB.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Easyrider
Posts: 44
Joined: 15 Dec 2009 01:18
Location: Tallinn, Estonia
Contact:

#42 Post by Easyrider » 19 Jan 2010 21:20

yo2lio wrote:No, sorry, I don't have support for USB.
Thanks for your answer. Any ideas where I can get it? :D
Sorry for my english!

Bytex
Posts: 459
Joined: 23 Jun 2008 00:58
Location: Palmanova (UD), Italy
Contact:

#43 Post by Bytex » 19 Jan 2010 21:54

You can use FT232RL chip.

Image

Best regards,
Max

http://www.b-vu.com

Easyrider
Posts: 44
Joined: 15 Dec 2009 01:18
Location: Tallinn, Estonia
Contact:

#44 Post by Easyrider » 20 Jan 2010 02:09

Thanks. I'm using ft232 for a long time, but some times it is not enought. Very need a low cost usb mcu. At this moment I'm using pic18f2450 (7,5$), but all what i need from them i can realise on pic18f13k50 (5$). Feel the difference? :wink:
Sorry for my english!

stevenindon
Posts: 466
Joined: 18 Apr 2008 03:46

#45 Post by stevenindon » 20 Jan 2010 04:09

All libraries updated.

In Ethernet library hardware check sum is not used any more, this according with ERRATA.

Enjoy!
Florin,

Thanks for the update. I have tested the new version and this is what i found :

There is a huge delay for Eth_UserTCP to return result from server comparing to previous version.
(* I guess the delay time is for collecting every chunk bytes and wait for time out... or can the user set a timeout --> and return result?)

As for long data 500+ bytes and above, we need to strCat all in coming data?

I have been trying to solve this for weeks... please help.

Thanks

Post Reply

Return to “mikroBasic PRO for PIC General”