Thanks for your kind reply
Quote:
Originally Posted by
HenrikOlsson
Because you are using the Oshonsoft compiler and "we" at this forum are using the MELABS PicBasicPro compiler (or PicBasicCompiler) - not the Oshonsoft BASIC compiler.
You need to "translate" the any examples not written for your compiler so the instructions matches your compilers instruction set. BASIC is not known for being the most standardised programming language. Most i spretty similar in the basic command set like GOTO, GOSUB, FOR-NEXT, WHILE_WEND etc but when it comes to all the "special commands" like SPI, PWM, LCD, etc etc each compiler has it's own way of handling it. There simply is no standard for those type of commands.
A quick look at the Oshonsoft site seems to indicate that what you are looking for is the [url=http://www.oshonsoft.com/picbasiccompilerreferencemanual.html#677] SPI Communication commands. Not ShiftLeft and ShiftRight - they are for shifting bits around in memory, not for shifting them in or out a pin.
Don't worry about beeing new to this, we've all been there at one time or another. However, you may get better help with your project by posting on the forum dedicated for the compiler you are using. Good luck!
/Henrik.
Hai brother,
for now i understood the differences among the instruction set on various compiler because of your reply and thanks for that.i want you to suggest me a compiler which will be better for future developments,because i think am still a wet clay and can be shaped.currently my project is communicating a pic16f690 to a external adc(LTC2400),I hope you will support me.THANKS A LOT FOR YOUR FURTHER SUGGESTIONS.
Thanks for your kind reply
Quote:
Originally Posted by
mackrackit
Most of us here use this to compile
http://store.melabs.com/prod/pbp.html
I am not familiar with oshonsoft compiler. I did not notice that you were using that earlier.
Basically you will have three pins on something like this.
DATA
CLOCK (SCK)
LATCH or Chip Select
i now understood the use of "sck" that it is used to control the serial clk (pin) of the adc,but in the oshonsoft i cant find any command to do that.it simply got spicson and spicsoff to control the "cs" pin of the adc and no more to control the spi clk.please give me a good idea to do my project.As i mentioned above
my project is to communicate the LTC2400 to a pic 16f690 and to display on a 16*2 lcd.The lcd portion working good.THANKS FOR NOW AND THANKS A LOT FOR YOUR FURTHER SUGGESTIONS.
Thanks for your suggestions
Quote:
Originally Posted by
HenrikOlsson
Hi,
I'm sure you have your reason but can you explain why you need 24bits?
I mean, 100bar across 24bits gives you a resolution of 0.000006bar. Does a transducer capable of measuring 100bar really resolve to that kind of precision?
If you already have your 4-20mA converted to 0-5V (and not 1-5V) you'd get ~0.1bar resolution with the built in 10bit ADC. You could do some oversampling to "emulate" a 12bit ADC giving you ~0.025bar resolution.
Just some ideas.
/Henrik.
THANKS FOR YOUR SUGGESTION MR.HENRIK
Actually as you said the 10 bit adc gives a 0.1 resolution on 0~100bar range which is as equal to a "primary master" and thats fine,but i want to use the 24bit adc because i want learn how to communicate a external adc through "spi" to the pic and particularly the 24bit adc is because thats the one i have in my hand to give a try.can you please explain me about the "oversampling to "emulate" a 12bit ADC to give a ~0.025bar resolution"
THANKS A LOT FOR SPENDING YOUR VALUABLE TIME FOR ME.
Thankyou very much for your support
Quote:
Originally Posted by
HenrikOlsson
Hi,
It's because the reading you get from the ADC most likely won't be stable at 252 across several consecutive samples, it will probably "tip over" towards 253 a couple of times.
Let's say you get the following values:
252, 253, 252, 253, 253, 252, 252, 253, 251, 253, 252, 253, 253, 252, 252, 252
The sum is 4039. Averaging them across 16 samples results in 252.4375 but you'll only "see" 252 which is ~0.29% off. Averaging them across 4 instead gives you 1009.75, you'll only "see" 1009 which is ~0.19% off.
Had the result been 1040 instead, averaging them across 16 samples would give you the same result, ~0.29% off while the oversampling method would only be 0.009% off.
Try it out and make sure you read thru the page I linked to, also look up the term oversampling. Here's a quote from Wikipedia:
/Henrik.
HAI HENRIK,
thanks for your support.as you said i tried the oversampling method and it gave me a better result than the previous method i used.but i have a transduser which range from 0~60000 psi on 4~20 mA,i used a 250 ohm resistor and i got 1~5v difference.
in this case do i need to use a external ADC more than 14bit resolution or can able to use the oversampling method on internal ADC by sampling 4096 times and divide by 64 to get a 16bit resolution.is it possible? or do we have any other ways to achive it.
THANKS FOR YOUR KIND SUPPORT,
PUGAL.