DSPIC additional string library
DSPIC additional string library
Hi,
DSPIC_aditional_string_library
Available functions and procedures :
* Swap_B
* Swap_F
* mem_cpy
* mem_cmp
* mem_set
* mem_chr
* Str_Len
* Str_Cut_Chr
* Str_Cat
* Str_Cpy
* Str_Chr
* Str_Replase_Chr
* Str_Split
* Str_Insert_Chr
* Str_AppendPre
* Str_AppendSuf
* Str_CutLeft
* Str_CutRight
* Byte2StrWithZeros
* Byte2Str
* Short2StrWithZeros
* Short2Str
* Word2StrWithZeros
* Word2Str
* Int2StrWithZeros
* Int2Str
* LongWord2StrWithZeros
* LongWord2Str
* LongInt2StrWithZeros
* LongInt2Str
* Float2Str
* Str2Byte
* Str2Word
* Str2LongWord
* Str2Short
* Str2Int
* Str2LongInt
* Str2Float
* Byte2Hex
* Hex2Byte
* Ip2Str
* Mac2Str
* Str2Ip
* Str2Mac
* Str2Ip_
* Str2Mac_
* Bcd2Dec
* Bcd2Dec16
* Dec2Bcd
* Dec2Bcd16
* DSPIC_aditional_string_library_version
You can download the code, descriptions and examples from :
http://www.microelemente.ro/MikroBasicD ... y_V1_1.zip
Enjoy !
DSPIC_aditional_string_library
Available functions and procedures :
* Swap_B
* Swap_F
* mem_cpy
* mem_cmp
* mem_set
* mem_chr
* Str_Len
* Str_Cut_Chr
* Str_Cat
* Str_Cpy
* Str_Chr
* Str_Replase_Chr
* Str_Split
* Str_Insert_Chr
* Str_AppendPre
* Str_AppendSuf
* Str_CutLeft
* Str_CutRight
* Byte2StrWithZeros
* Byte2Str
* Short2StrWithZeros
* Short2Str
* Word2StrWithZeros
* Word2Str
* Int2StrWithZeros
* Int2Str
* LongWord2StrWithZeros
* LongWord2Str
* LongInt2StrWithZeros
* LongInt2Str
* Float2Str
* Str2Byte
* Str2Word
* Str2LongWord
* Str2Short
* Str2Int
* Str2LongInt
* Str2Float
* Byte2Hex
* Hex2Byte
* Ip2Str
* Mac2Str
* Str2Ip
* Str2Mac
* Str2Ip_
* Str2Mac_
* Bcd2Dec
* Bcd2Dec16
* Dec2Bcd
* Dec2Bcd16
* DSPIC_aditional_string_library_version
You can download the code, descriptions and examples from :
http://www.microelemente.ro/MikroBasicD ... y_V1_1.zip
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
#### I found the error - I spelled "additional" correctly in the Include statement but you spelled with only one "d"
Just in time! BUT...
I'm trying to use the Float2Str and Int2StrWithZeros but, it gives an error (see below example). I unzipped and loaded the .mcl into the Uses folder and restarted dsPic Basic.
0.9 currently this value displays as 9e-1 (without a decimal or zero's)
Thanks,
bt
Just in time! BUT...
I'm trying to use the Float2Str and Int2StrWithZeros but, it gives an error (see below example). I unzipped and loaded the .mcl into the Uses folder and restarted dsPic Basic.
These will be very useful for me - as I need to display:404:31 E-3 Identifier 'Float2Str' was not declared Galaxy1.dbas
0.9 currently this value displays as 9e-1 (without a decimal or zero's)
Thanks,
bt
O no ....
Put this at the top of your program after program <name> :
Put this at the top of your program after program <name> :
Code: Select all
include "DSPIC_aditional_string_library"
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
Yes, I found our collective typeO. All works really well - Thank you!
One thing - more of a 'Wish' is to be able to align the decimal point, for display. For instance;
I have two floating numbers that can range from 0.000123 to 567.1234. Currently, as the numbers change, so does the position of the decimal. It would be really nice to be able to always keep the decimal in the same LCD display position, example with 4 digits to right of decimal:
One thing - more of a 'Wish' is to be able to align the decimal point, for display. For instance;
I have two floating numbers that can range from 0.000123 to 567.1234. Currently, as the numbers change, so does the position of the decimal. It would be really nice to be able to always keep the decimal in the same LCD display position, example with 4 digits to right of decimal:
Code: Select all
0.0001
457.1234
Yes , It's easy to make this :
Code: Select all
Float2Str(-0.1234,data1,4)
i = Str_Len(data1)
while i < 8 'In your particular case, max. length of string is 8
Str_AppendPre(data1," ") ' Insert space at the beginning of the string
inc(i)
wend
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
Thanks yo2lio , great work.
What about a Word2Hex ? Since we are working with dsPIC that would be extremely useful.
Also is there a way that you show the source code. Just for learning purposes. I am interested in Byte2Hex in particular. So I can port it to my EasyPIC 4 too?
Thanks again
Csaba
What about a Word2Hex ? Since we are working with dsPIC that would be extremely useful.
Also is there a way that you show the source code. Just for learning purposes. I am interested in Byte2Hex in particular. So I can port it to my EasyPIC 4 too?
Thanks again
Csaba
We have machines that build machines but we need programs that write better programs.
CNC & AI
CNC & AI
Csaba wrote:Thanks yo2lio , great work.
What about a Word2Hex ? Since we are working with dsPIC that would be extremely useful.
Also is there a way that you show the source code. Just for learning purposes. I am interested in Byte2Hex in particular. So I can port it to my EasyPIC 4 too?
Thanks again
Csaba
Word2Hex will be available in the next release .
About source code ... I wrote this library in ASM, source code is not available.
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
-
- Posts: 130
- Joined: 28 Nov 2006 17:59
Hi Florin
Is there a method with this library to convert dec to ascii? Specifically, many RTCs return odd BCD values depending on the register, and often the initial conversion is to decimal (preferred for internal handling). But if you want to send that off to a USART terminal, or to a FAT file or whatever, it would be easier to convert to ASCII before send, so that it would be directly compatible with ASCII terminals and file readers. Seems like most libraries are fine for 0-9, since that is just an OR 0x30 operation, but for double-digit values, it gets a little ugly. Just wondering if this is native to one of your existing functions?
Regards,
R
Is there a method with this library to convert dec to ascii? Specifically, many RTCs return odd BCD values depending on the register, and often the initial conversion is to decimal (preferred for internal handling). But if you want to send that off to a USART terminal, or to a FAT file or whatever, it would be easier to convert to ASCII before send, so that it would be directly compatible with ASCII terminals and file readers. Seems like most libraries are fine for 0-9, since that is just an OR 0x30 operation, but for double-digit values, it gets a little ugly. Just wondering if this is native to one of your existing functions?
Regards,
R
-
- Posts: 17
- Joined: 28 Apr 2008 12:16
- Location: Egypt / Cairo
Hello,
Unfortunately compiled library *.mcl file are not compatible with MikroC and source code in MikroPascal is not available.
Sorry .
Unfortunately compiled library *.mcl file are not compatible with MikroC and source code in MikroPascal is not available.
Sorry .
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
-
- Posts: 17
- Joined: 28 Apr 2008 12:16
- Location: Egypt / Cairo
Thanks for fast replyyo2lio wrote:Hello,
Unfortunately compiled library *.mcl file are not compatible with MikroC and source code in MikroPascal is not available.
Sorry .
Ok, how can I build my own library in MikroC? And how can I open the main code of your library?
If I need to go through inside the library which is combined with each compiler, How can I do that?
BR
Hello,mbluethunder7000 wrote: Ok, how can I build my own library in MikroC?
Here are the steps for creating a library:
1) Create new C file (mikroC->File->New)
2) Save the file in one of the following folders:
C:\Program Files\Mikroelektronika\mikroC\Uses\P16\
C:\Program Files\Mikroelektronika\mikroC\Uses\P18\
If you are creating library for PIC16 MCU family the file should be saved in P16 folder.
If you are creating library for PIC18 MCU family the file should be saved in P18 folder.
If you are creating library for PIC16 and PIC18 MCU families the file should be saved in both folders.
3) Write the code for your library and save it
4) Open the "mlk" file for the MCU that you want to use. The "mlk" file is placed in the following folder:
C:\Program Files\Mikroelektronika\mikroC\defs\
Add the following line in the definition file for the MCU:
#pragma SetLib(Your_Lib_ Name)
note: this step should be repeated for each MCU that you intend to use
5) Restart the compiler
Best regards
LibStock
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus
http://www.libstock.com/
mikroSDK
https://www.mikroe.com/mikrosdk
mikroBUS
https://www.mikroe.com/mikrobus
Hi,
New version of MikroBasic DSPIC_Aditional_String_Library available here :
http://www.microelemente.ro/MikroBasicD ... y_V2_0.zip
Unfortunately this library was released from 12 May I forgot to put on the forum ... First signs of getting old ...
To use this library , copy DSPIC_aditional_string_library.mcl file in ../Uses/ folder and put this line at the beginning of your program :
Enjoy !
New version of MikroBasic DSPIC_Aditional_String_Library available here :
http://www.microelemente.ro/MikroBasicD ... y_V2_0.zip
Unfortunately this library was released from 12 May I forgot to put on the forum ... First signs of getting old ...
To use this library , copy DSPIC_aditional_string_library.mcl file in ../Uses/ folder and put this line at the beginning of your program :
Code: Select all
include "DSPIC_aditional_string_library"
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
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro