CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

comparison

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lym
Guest







comparison
PostPosted: Wed Feb 02, 2005 7:49 am     Reply with quote

Can someone please give any suggestion on programming PIC16F877A.

You see, there are 6 sets of 10bits data stored in the memory of the pic using the internal ADC to convert the analog signal to digital. Then, another set of 10bits is alos goes through the same process as the 6 sets of data but is then compared with each set of data. When there is a match with any of the 6 sets of data, a high is sent out to the pins of PORTB respectively.

So now, my current problem is that the current data jus isn't able to match with any of the stored data in the memory. It's because the data keeps on varying. I have set a range of approximation to the current data so that at least the data stored in the memory would be able to match with it but it wasn't successful.

Do any of you have some ideas to make the data match with the data sotred in the memory?
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Feb 02, 2005 8:00 am     Reply with quote

So are you saying that the ADC voltage is varying so much that is doesn't match a stored value for very long Question If so, you could lose some of the LSB's or design the analog portion of your circuit so that it is more stable.
Ttelmah
Guest







PostPosted: Wed Feb 02, 2005 9:02 am     Reply with quote

It'll never happen!.
There is a degree of random noise in any sampling process.
Start by doing everything you can to reduce electronic noise in the area of the ADC. Then sample at a higher frequency than you want to use, and perform a smoothing algorithm on these results to give the 'values'. Then instead of doing a direct 'compare', perfom a 'delta' test. Basically for each value in the two sets, subtract one from the other, and square this value. Generate a sum of these six values. This then gives you a number corresponding to 'nearness'. Check this total to decide if the values ae 'close'. If for instance, each pair differed by just 1, the sum would be 6. However if two of the pairs differed by 4, the sum would leap up to 36. The number will grow extremely quickly for any major difference, but be fairly small for small differences. If you allow perhaps '20' as an acceptable level for your test, you have a chance of it working. :-)

Best Wishes
lym
Guest







PostPosted: Wed Feb 02, 2005 9:02 am     Reply with quote

The digital bits varies alot until the LEDs connected at the output can be seen to be blinking until it almost remains at a constant.
The analog input is fine. It's possible to take away the a few of the LSB since it's the internal ADc that I use is the 10bit ADC.
Will thy that. Besides that, any other suggestion?

What I trying to do now is to delay the time of the conversion in order for the signal to be sent at the exact time. But that also is difficult because the signal that is sent is a voice signal amplified by the microphone. So it depends on exaxt the person who is sending the voice into the mic can be.
lym
Guest







PostPosted: Wed Feb 02, 2005 9:19 am     Reply with quote

One more thing which I tried was to extent the range of the current bits which was to match with the bits stored in the memory. I put it to +200 to -200 approximationbut that also didn't match the data.WhenI increased the range 400 or 500, it showed that all gave a match which wasn't correct.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group