Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
hhyong99 said:i have a question, can i use P18F452 to do voice sampling?? i will have a preamp circuit, output of this will go to PIC... so, do i use ADC or PWM to convert the voice and send it through IR??
anyone pls explain a bit what actually PWM doing... thank you...
Nigel Goodwin said:Why do you want to do this?, why not just send the analogue audio over an IR link?.
hhyong99 said:Nigel Goodwin said:Why do you want to do this?, why not just send the analogue audio over an IR link?.
if just send the analogue audio over an IR link, that's mean i don't have to go through PIC?? then what should i do for that?? no need programming to do the sending or what? i'm using MP2120..
Yes and Yes, this needs to be calculated, just read the datasheet carefully.hhyong99 said:thanks jay...
Fosc / 32 is clock dividers?? how should i choose this?? i read the datasheet, there's acquisition time, do i need to calculate that before choosing convertion clock??
You have to sample the sine wave with at least 2*f sampling frequency (where f is the is the frequency of the sine wave) and the output is integer number (0-1023). This number is "inside the PIC", you need to write your own SW to output it to TX pin...if i ADC a sine wave, the output should be in decimal number?? the output is at TX??
hhyong99 said:sorry, Nigel, but how can i set the ADC to use 8 bits instead of 10 bits??
hhyong99 said:sorry, Nigel, but how can i set the ADC to use 8 bits instead of 10 bits??
eblc1388 said:You can't. You can select how the 10-bit result is placed in two registers. This is done by changing a bit as mentioned by Nigel in the above post.
The ADC gives 10-bit resolution and takes a certain time. You can use any number of bits of the result but the conversion will not be faster even if you do.
hhyong99 said:sorry, Nigel, but how can i set the ADC to use 8 bits instead of 10 bits??
ADCON1 is really a little more complicated, although it's only split into two sections. The first section is a single bit, ADFM, this is the Result Format Selection Bit, and selects if the output is Right Justified (bit set) or Left Justified (bit cleared). The advantage of this is that it makes it very easy to use as an 8 bit converter (instead of ten bit) - by clearing this bit, and reading just ADRESH, we get an 8 bit result, ignoring the two least significant bits in ADRESL.
hhyong99 said:if i want to set my sampling rate at 10kHz, osilloscope the result of the convertion at the one of my output pin, can that be done??
Joel Rainville said:But are you sure you want to use the C language for your PIC programming? I'm not saying it is a bad choice. It's a very good choice if you are going to work on large firmware projects, for instance.
But I'm saying there is an alternative called assembly language. MPLAB includes MPASM which will assemble (compile if you prefer) your assembly source into a hex file. And this is completely free.
So, if you were me and knew ABSOLUTELY NOTHING about programming...and I mean NOTHING!... how would you BEGIN to teach yourself assembly language. I've seen some different tutorials on it, but they all assume that you're somewhat familiar with programming. I don't know ANYTHING. I understand the concepts of an If/then statement, but I need to know the real deal.