Page 1 of 1
PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 2:00 pm
by Ondra
Good day all. I am having some trouble using the PIC12F683. It seems that the device will not receive input on Pin A1.
I searched the forum and found that this device has had some issues with its fcd file. Since what I am trying to do is
simple I am inclined to think that the problem might be with the fcd file. I created a simple loop, flashing an LED on for 1
second, Off 1 second. It works fine. I than, using the same file added an input on port A1 to switch the LED on when high
then off when low. And It doen't work. I searched the forum and downloaded what I believe is the latest fcd for the 12F683,
and still it doesn't work. Could someone have a look into this? I tried using the internal clock set at 4 and then at 8MHz,
Watchdog is off. Thanks in advance.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 3:26 pm
by Benj
Hello Ondra
Would you mind posting the C code generated by your program and I will see if I can spot why this is going wrong.
Re: PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 3:34 pm
by Benj
Adding the following to the very start of your program in a c code icon should allow the device to work correctly,
I will still need the C code file and this way I should also be able to fix your problem at the FCD level.
Re: PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 4:34 pm
by Ondra
Here it is.
Re: PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 4:52 pm
by Ondra
Thanks Benj. That C code worked.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Tue Oct 20, 2009 6:09 pm
by Ondra
Hi Benj, I seem to be having the same problem with port pin A3 not receiving
acknowledging the input change.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 9:31 am
by Benj
Hi Ondra
Ok the C code confirmed that your FCD file was missing a initialisation instruction. I will update this in the next release of Flowcode but for now you can add the following to your FCD file if you do not want the have to add that C code to every program.
In the
Code: Select all
section of the 12F683.FCD file find the line that starts.
Initialise="
Change this line to look like this.
Initialise="ansel = 0x00;\ncmcon0 = 0x07;\n"
Then save the file and restart Flowcode and you should no longer require the C code.
Not sure why your A3 input pin is not working though it is multiplexed with the MCLR, have you disabled this in the configuration?
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 10:45 am
by Ondra
Not sure why your A3 input pin is not working though it is multiplexed with the MCLR, have you disabled this in the configuration?
No I did not disable it. Should I have?
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 10:55 am
by Benj
Hello Ondra
Well if you don't disable the MCLR function in the config settings then the pin will act to reset the device if you bring the input signal low.
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 11:10 am
by Ondra
GP3 pin 4 is the MCLR pin. It's A3 GP4 Pin 3 that's not working right. Are you saying that disabling the MCLR funtion might clear the issue I am having on A3 GP4 Pin 3? If so I have 2 option internal and external how do you disable the MCLR ?
Also just checking, for the Initialize code is it ncmcon0 or cmcon0.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 12:17 pm
by Benj
Hello Ondra
GP3 is port pin A3 or device pin 4 - This pin is also the MCLR by default
GP4 is port pin A4 or device pin 3 or analogue pin AN3 - This pin is a Oscillator pin by default
GP5 is port pin A5 or device pin 2 - This pin is a Oscillator pin by default
Also the initialise is correct. the \n is converted into a carriage return in the output C code.
Initialise="ansel = 0x00;\ncmcon0 = 0x07;\n"
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 1:14 pm
by Ondra
OK, looking at the data sheet, device pin 3 is AN3 default OSC2. So I guess the question should be, how do I change the default oscillator pins to I/O pins, if that's possible.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 2:31 pm
by Ondra
Looking at the data sheet I see the following: -
8. INTOSCIO – Internal oscillator with I/O on
OSC1/CLKIN and OSC2/CLKOUT.
By this, I think that it is possible to use the OSC pins as I/O pins. But my clock option under config
does not seem to support INTOSCIO, is their a work around?
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 2:34 pm
by Benj
Hello Ondra
If you use the "Internal RC No Clock" option then this is the same as the INTOSCIO setting from the datasheet.
To read pin 3 you would need to use an input icon in single bit mode and read bit A4.
Hopefully this should work to allow you to use this input pin.
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 2:47 pm
by Ondra
That did it. Thanks again. I loooooovvvvvveeee flowcode and the great support. It's the best.
Ondra
Re: PIC12F683 not receving inputs on Port A1
Posted: Wed Oct 21, 2009 2:52 pm
by Benj
Brilliant, thanks for letting me know.
