Hi Benj.
Compliments of the season.
I'm trying to get a small project going were i'm inputing 2 frquencies to pin A0 & A1 and internenally comparing to an internal counter and when the inputs reach a preset value ( 110 & 160Hz) than RB7 & RB8 will go ON respectively, if the frequency fall or goes above the preset value the output will go OFF.
The program works well when I simulate it in PROTEUS but not on the actual CHIP. I have other LED's on Portb that work but what's connected to Porta doesn't work.
I think the problem is I have to configure Porta as a digital I/O and as far I can see from the data sheet Port a4 to a0 are configured as Analog as default after reset.
Could you help me configuring Porta as an Digital I/O.
Many Thanks.
Pinto Ramos
By the way, when will FlowCode 4 be availabe, I would like to place an order.
Disabling Analog Port on PIC16f88
- 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: Disabling Analog Port on PIC16f88
Hello Pinto
Flowcode should set the porta pins to digital by default at the start of your program. Look at the compiled C code and you should see the following line at the start of your main function:
ansel = 0x00;
Which pins of porta are you using? RA5 / MCLR pin is capable of input only incase this is the problem.
Best way to test is to write a simple program to output bits or input bits on porta to ensure what you think is going to work is actually going to work.
Flowcode 4 should be available March time, sorry for the extra delay but were currently still cramming in functionality.
Flowcode should set the porta pins to digital by default at the start of your program. Look at the compiled C code and you should see the following line at the start of your main function:
ansel = 0x00;
Which pins of porta are you using? RA5 / MCLR pin is capable of input only incase this is the problem.
Best way to test is to write a simple program to output bits or input bits on porta to ensure what you think is going to work is actually going to work.
Flowcode 4 should be available March time, sorry for the extra delay but were currently still cramming in functionality.
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
-
- Flowcode v5 User
- Posts: 71
- Joined: Fri Nov 03, 2006 2:28 pm
- Location: RSA
- Been thanked: 1 time
- Contact:
Re: Disabling Analog Port on PIC16f88
Hi Benj,
Thanks.
I checked the C code generated and noticed that the compiler generates the following code:
ansel=0 and not ansel=0x00 as you mentioned.
Could that cause a problem?
Regards
Pinto
Thanks.
I checked the C code generated and noticed that the compiler generates the following code:
Code: Select all
void main()
{
//Initialisation
ansel = 0;
cmcon = 0x07;
Could that cause a problem?
Regards
Pinto
- 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: Disabling Analog Port on PIC16f88
Hello Pinto
Unfortunaltly ansel = 0 and ansel=0x00 equate to the the same thing -> portA = digital.
Can you output values to the port?
Unfortunaltly ansel = 0 and ansel=0x00 equate to the the same thing -> portA = digital.
Can you output values to the port?
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
-
- Flowcode v5 User
- Posts: 71
- Joined: Fri Nov 03, 2006 2:28 pm
- Location: RSA
- Been thanked: 1 time
- Contact:
Re: Disabling Analog Port on PIC16f88
Hi Benj,
I checked and FlowCode generates but I cann't get the F88 to see the frequency on the RA0 & RA1.
I tried the same code with F877 and connected two LCD dislays to port C & D and inserted flags on the code to see if the code actually branched and the code works with the 877.
I than decided to try a 628 and voilΓ , it worked.
I have no idea of what the problem is with the F88.
It doesn't matter what chip I use for the my application, but is frustating not to been able to get the f88 to work. Anyway I will have another go later again.
Thank you for your help.
I can't wait for my book to arrive, Ive ordered a week ago and should be here any time and more importante the release of Flowcode 4.
Regards
Pinto
I checked and FlowCode generates
Code: Select all
void main()
{
//Initialisation
ansel = 0;
cmcon = 0x07;
I tried the same code with F877 and connected two LCD dislays to port C & D and inserted flags on the code to see if the code actually branched and the code works with the 877.
I than decided to try a 628 and voilΓ , it worked.
I have no idea of what the problem is with the F88.
It doesn't matter what chip I use for the my application, but is frustating not to been able to get the f88 to work. Anyway I will have another go later again.
Thank you for your help.
I can't wait for my book to arrive, Ive ordered a week ago and should be here any time and more importante the release of Flowcode 4.
Regards
Pinto