PIC12F683 not receving inputs on Port A1
PIC12F683 not receving inputs on Port A1
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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.
Would you mind posting the C code generated by your program and I will see if I can spot why this is going wrong.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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.
Code: Select all
cmcon0 = 0x07;
ansel = 0x00;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F683 not receving inputs on Port A1
Here it is.
- Attachments
-
- Pebble led test.c
- (3.64 KiB) Downloaded 357 times
Re: PIC12F683 not receving inputs on Port A1
Hi Benj, I seem to be having the same problem with port pin A3 not receiving
acknowledging the input change.
Ondra
acknowledging the input change.
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F683 not receving inputs on Port A1
No I did not disable it. Should I have?Not sure why your A3 input pin is not working though it is multiplexed with the MCLR, have you disabled this in the configuration?
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F683 not receving inputs on Port A1
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
Also just checking, for the Initialize code is it ncmcon0 or cmcon0.
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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"
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"
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F683 not receving inputs on Port A1
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
Ondra
Re: PIC12F683 not receving inputs on Port A1
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC12F683 not receving inputs on Port A1
That did it. Thanks again. I loooooovvvvvveeee flowcode and the great support. It's the best.
Ondra
Ondra
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC12F683 not receving inputs on Port A1
Brilliant, thanks for letting me know. 

Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel