PDA

View Full Version : Microchip pic10F220



cyberbiota
- 7th November 2006, 16:46
Does anyone have any experience with the new 10F2XX parts? I am looking to migrate a fairly simple design from the 16F676 to the 10F220 (smaller part, less expensive & etc.) and have never used any of the baseline parts before. I need to be able to run one chanel of ADC and output PWM. Are there any tricks to setting the ADC register on this part? I just sampled a few of them, but thought I could start tweaking the code whilst I wait...

TIA-

peter

sayzer
- 7th November 2006, 18:18
Hi cyberbiota,

Put 10F2* into search box and hit enter.


----------------------------------

HenrikOlsson
- 7th November 2006, 18:36
Hi,
As far as I can see from reading the datasheet everything is controled by the ADCON0 register. Here's my untested shot at it:



Result var BYTE

TRIS = %00000001 'Set GP0 Input, rest as outputs.

ADCON0.7 = 0 'Set GP1 as digital
ADCON0.6 = 1 'Set GP0 as analog
ADCON0.0 = 1 'Turn ADC module ON

ADConvert:
ADCON0.3 = 0
ADCON0.2 = 0 'Select AN0 for covertsion.
ADCON0.1 = 1 'Start conversion.

While ADCON0.1 = 1 'ADCON0.1 will be reset when conversion is done
WEND 'so lets wait here 'till then.

Result = ADRES 'Store result.

Toggle GPIO.1 'Or whatever.....
Pause 250
Goto ADConvert 'Do it again.


May work, may not, have a look at section 7.0 in the datasheet.

/Henrik Olsson.

cyberbiota
- 7th November 2006, 20:29
Henrik and Sayzer-

Thanks for all of the info. I never thought of trying the wildcard extension in the search box...duh!!!

peter