Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to convert numeric to string variables in PicBasic?

Status
Not open for further replies.

gzorzi

Junior Member level 1
Joined
Jul 24, 2002
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
123
PicBasic question

I have a numeric variables and I want convert it on string variable or concatenate variable.
How do I do it ?
example
a var byte
b var byte
c var word

a=$44
b=$33

concatenate
c=$4433

or string variable
c="4433"
Thanks
 

Re: PicBasic question

Hi Gzorzi,

Try this:

c = a << 8 + b

Tornado
 

Re: PicBasic question

for concatenating do this:
r= a* (10^(log(b)+ 1)) + b;
^ means power
 

Re: PicBasic question

Hi verilog_crack, yes that's another way but here we have a PIC which has hard time to multiply and calculate that takes a lot of memory to implement, so by shifting 8 places to the left is memory efficient and a fast way of doing it. Ofcourse Gzorzi you have to try both and let us know the results, for future apps.
Verilog_crack your way is interesting too. I will give it a try as well.

Regards
Tornado
 

Re: PicBasic question

Hi verilog_crack, I tried your formula but PICBASIC pro and other
picbasic compilers they don't support LOG function directly.
As per their manuals.

Tornado
 

Re: PicBasic question

Tornado said:
Hi verilog_crack, I tried your formula but PICBASIC pro and other
picbasic compilers they don't support LOG function directly.
As per their manuals.

Tornado
Hi,
You can make a function to compute log(a) very easy:
i= 1;
while (i*10< a) i= i+1;
 

Re: PicBasic question

Again it will compile with error, are you using PICbasic compiler? if you compile your way how many words it takes? My method takes 35 words.
Please compile yours.

Tornado
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top