Are you disabling A/D & comparators?
not that bingo after all...Originally Posted by peu
Here is the full code:
red is supposed to stay high until the for-next that put it back to low, but as soon the rise for-next is finished it goes off.Code:trisio =%00000000 ansel =%00000000 conta var byte ciclos var byte pasos var byte red var gpio.1 green var gpio.2 blue var gpio.4 'pote var gpio.0 ciclos =10 low red high blue high green pasos =16 loop: 'ADCIN pote, pasos for conta=0 to 255 step pasos 'blue fall pwm blue, 255-conta, ciclos next conta low blue for conta=0 to 255 step pasos 'red rise pwm red, conta, ciclos next conta high red for conta=0 to 255 step pasos 'green fall pwm green, 255-conta, ciclos next conta low green for conta=0 to 255 step pasos 'blue rise pwm blue, conta, ciclos next conta high blue for conta=0 to 255 step pasos 'red fall pwm red, 255-conta, ciclos next conta low red for conta=0 to 255 step pasos 'green rise pwm green, conta, ciclos next conta high green goto loop end
any idea?
Pablo
CMCON0=7
about now?
Last edited by mister_e; - 19th January 2006 at 00:11.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Pablo,
Look in the data sheet under Comparator Module. Look at the "default" POR (power on reset) value in CMCON0.
Now look at the drawing in FIGURE 8-3: COMPARATOR I/O OPERATING MODES.
Place CMCON0 = X in the initialization section of your code.
Replace X with the value shown in this section that will turn "Comparator Off".
Thanks Bruce, your answer helped me two ways, to solve the problem and to understand a little more how to read datasheets, I have the 12F683 printed&binded datasheet next to me, but since I didn't know where to look exactly I wast lost in the sea of trial&error.Originally Posted by Bruce
Thanks again, and thanks Steve who also gave me the right answer!
Pablo
Hi Bruce,
I won't ask howto but where to look for the answer
I'm trying to use gpio.3 as an input, but I dont know how to set it as such.
Setting trisio=%00001000 does not help me
Thanks in advance
Originally Posted by Bruce
Hi Pablo,
PBP has default config fuse settings in device specific header files. Look in your PBP directory for a file named 12F683.INC. Open this file.
You'll see the PBP default config fuse settings for this target PIC. It looks somthing like this;
This is used only if you're using the default PM asembler that ships with PBP.
device pic12F683, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
And this one is used when you're using the Microchip MPASM assembler.
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
Notice how the default settings for /MCLR (GPIO.3) all have the reset function enabled (mclr_on, _MCLRE_ON)?
You can over-ride these default config fuse settings, and make GPIO.3 available as an input by editing the file, and changing it to mclr_off or _MCLRE_OFF, save the file, and re-compile.
Or simply add this line to the beginning of your code (if using the PM asembler);
@ device pic12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
Now you just need to make the pin an input by setting the appropriate TRIS bit.
Melanie posted a nice tutorial on config settings here:
http://www.picbasic.co.uk/forum/showthread.php?t=543 so I won't elaborate.
Thanks again Bruce, just added that line, and now I can use this extra pin !!
I trully appreciate your answers.
Pablo
Bookmarks