A simple project to get to know the 18F242. A flashing LED with the frequency controlled by a variable resistor. Turn left to increase the flashing frequence, turn right to reduce.
The code is very comparable to that used for a 16F877. Note however that this time the resolution is set to ‘low’ and the sample is also taken in low resolution (PIC_ADC_read_low_res (0, resist)). That’s because this PIC is 16 bit, so high and low byte this time really means something.
Everything is relative of course. Low res means 255 steps. The variable resistor applies a voltage between 0 and 5 volts. In 255 steps this means 0.02 volts resolution, impressive!!
Visit Here for more.