Additional library for MikroPascal PRO 2009

General discussion on mikroPascal PRO for PIC.
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#22 Post by Dany » 06 Oct 2009 10:27

yo2lio wrote:Added SaveAll procedure in pic_additional_string_library.
call this routine in main and interrupt routine, if you want to save FSRx and PRODx registers in interrupt.
Is just placing a call to SaveAll and in the interrupt routine doing the job?
Is this needed when using your MP Pro libraries?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

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

#23 Post by yo2lio » 06 Oct 2009 11:21

Dany wrote:
yo2lio wrote:Added SaveAll procedure in pic_additional_string_library.
call this routine in main and interrupt routine, if you want to save FSRx and PRODx registers in interrupt.
Is just placing a call to SaveAll and in the interrupt routine doing the job?
Is this needed when using your MP Pro libraries?
Unfortunately, yes.

This depend of interrupt code.

If interrupt routine don't use any FSR's registers you can not use this.
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

Donald Shimoda
Posts: 553
Joined: 27 Feb 2006 17:00
Location: Argentina
Contact:

#24 Post by Donald Shimoda » 06 Oct 2009 13:28

yo2lio wrote: If interrupt routine don't use any FSR's registers you can not use this.
Im confused.

You mind cannot use or dont need?

Best Regards.
Donald Shimoda.

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

#25 Post by yo2lio » 06 Oct 2009 13:50

Donald Shimoda wrote:
yo2lio wrote: If interrupt routine don't use any FSR's registers you can not use this.
Im confused.

You mind cannot use or dont need?

Best Regards.
If you stay in Pascal, all is OK.

If you use pointers also all is OK.

If you use ASM code, all is OK.

If you use FSR register, in this way:

Code: Select all

FSR1 := @variable;
POSTINC1 := 45;
etc;
then you must tell this to compiler... and this only in some particular cases, when compiler don't use FSRx registers itself.

For this I create SaveAll routine. This, must be called somewhere in Interrupt and in main routine. Only for P18.
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

Donald Shimoda
Posts: 553
Joined: 27 Feb 2006 17:00
Location: Argentina
Contact:

#26 Post by Donald Shimoda » 06 Oct 2009 14:21

yo2lio wrote:

Code: Select all

FSR1 := @variable;
POSTINC1 := 45;
etc;
then you must tell this to compiler... and this only in some particular cases, when compiler don't use FSRx registers itself.

For this I create SaveAll routine. This, must be called somewhere in Interrupt and in main routine. Only for P18.
And what happens when i use thirdy party libraries like yours? i must call SaveAll in my code?
Donald Shimoda.

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

#27 Post by yo2lio » 06 Oct 2009 15:40

Donald Shimoda wrote: And what happens when i use thirdy party libraries like yours? i must call SaveAll in my code?
Only if you want!
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

Donald Shimoda
Posts: 553
Joined: 27 Feb 2006 17:00
Location: Argentina
Contact:

#28 Post by Donald Shimoda » 06 Oct 2009 16:03

yo2lio wrote:
Donald Shimoda wrote: And what happens when i use thirdy party libraries like yours? i must call SaveAll in my code?
Only if you want!
Ok, so my interrupt routines dont use FSR i dont need to call SaveAll. is clear now.


TIA
Donald Shimoda.

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

#29 Post by yo2lio » 12 Oct 2009 10:13

New version available.

Additional library for MikroPascal PRO 2009 are available here :
http://www.microelemente.ro/MikroPascal ... y_V1_4.zip

Added Fat32_SPI1 and Fat32_SPI2 library, thanks to Dany.

All about this new Fat32 library you will found here: http://users.edpnet.be/rosseel01/DRO/PIC/index.htm

Example, available soon.
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

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

#30 Post by yo2lio » 14 Jan 2010 14:10

All libraries and example 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

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#31 Post by Dany » 14 Jan 2010 20:43

yo2lio wrote:Enjoy!
Thanks! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

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

#32 Post by yo2lio » 27 Jan 2010 15:30

Library updated, restored hw_cksum variable.
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

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#33 Post by Dany » 28 Jan 2010 11:34

yo2lio wrote:Library updated, restored hw_cksum variable.
Thanks! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

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

Re: Additional library for MikroPascal PRO 2009

#34 Post by yo2lio » 09 Mar 2010 21:34

Ethernet library updated, both ENC28J60 and PIC18F97J60 family.

Now, library can receive UDP broadcast packets and can insert dynamic string variables in HTML code.

1. UDP broadcast
- can be enabled or disabled via udp_broadcast flag.
this flag is default false and can be activated after Eth_Init routine.

Code: Select all

  Eth_Init;
  udp_broadcast := true; 
- when one UDP broadcast packet is received, this arrive in Eth_UserUDP routine and a new flag broadcast_packet become true. For non broadcast packet, this flag have false state.

2. Dynamic string variables in HTML code
- added a new value for Socket.RAM_ROM, this is 2.
- when Socket[j].RAM_ROM = 2, MCU will search in HTML const after "@" char. This must be followed by two numbers from 00 to 99.
- user must make a table (array[x] of word) with string variables address. When MCU will found "@00" will copy in ETH mem, the string that have start address located in first location of array of word table.
- this table must be compiled with absolute directive and the start address of table must be initialized in dynamic_var_addr variable.

Code: Select all

var dat4 : string[10];
    dat5 : string[5];
    dat9 : string[10];
    dat10 : string[5];

    my_dynamic_var : array[4] of word; absolute $100;

...

procedure Init_dynamic_var;
begin
  my_dynamic_var[0] := word(@dat4);
  my_dynamic_var[1] := word(@dat5);
  my_dynamic_var[2] := word(@dat9);
  my_dynamic_var[3] := word(@dat10);
end;

...

Eth_Init;

dynamic_var_addr := $100; // after Eth_Init...
Init_dynamic_var;

Code: Select all

procedure HTTPProcDataIn(len_ : word; j : byte);
var i : byte;
    getRequest,txt31 : string[32];
begin
  if len_ > 32 then len_ := 32;

  CopyEthMem_CPToRam(word(@getRequest), len_);
    
  txt31 := httpMethod;
  
  if Mem_Cmp(word(@getRequest), word(@txt31), Str_Len(txt31)) <> 0 then exit;      // only GET method is supported here

  Socket[j].RAM_ROM := 2; // here ....
  Socket[j].Keep_Alive := false;
  Socket[j].Start_addr := @indexPage1;
  Socket[j].Stop_addr := @indexPage1 + indexPage1_len;
end;

Code: Select all

'<table width="100%" cellspacing="0">'+
		'<tr>'+
			'<td class="gensmall">Last visit was: @00 </td>'+ // MCU will put instead of @00, string dat4

			'<td class="gensmall" align="right">It is currently @01 <br /></td>'+ // MCU will put instead of @00, string dat5
		'</tr>'+
		'</table>';
Library here: http://www.microelemente.ro/MikroPascal ... y_V1_4.zip
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

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Additional library for MikroPascal PRO 2009

#35 Post by Dany » 10 Mar 2010 09:37

Thanks! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

alcidesramos
Posts: 272
Joined: 17 Feb 2009 02:39
Location: Colombia
Contact:

Re: Additional library for MikroPascal PRO 2009

#36 Post by alcidesramos » 01 Apr 2010 00:52

Thanks! excellent work.

Post Reply

Return to “mikroPascal PRO for PIC General”