Page 1 of 1
Posted: Thu Nov 11, 2010 9:56 am
What I mean is;
Im using a ECIO40 (18f4455) with application board, LCD E-block on port A, I want to use analoge inputs aswell as digital inputs with internal pull-up resistors on portB.
Now there are some problems:
I know you have to make "adcon0 = 0x30;" in order for the LCD to work on porta.
I know you have to make "intcon2 &= 0x7f;" to enable the pull-ups.
I've read that the internal pull-ups of analoge inputs get disabled.
But using this all together won't work very well, I can get the the 2 seperate halfs work, but not together, I'm probly doing some registers wrong, some help over here please?
Thanks in advance,
Posted: Wed Nov 17, 2010 11:49 am
Anyone feels like having thew knowledge to help me out here?
Posted: Thu Nov 18, 2010 2:48 pm
What is happening when you try to use both together? Is the LCD failing or is it the pull ups?
I think to enable the pull up resistors you should instead be using this line of code.
intcon2 = intcon2 & 0x7F;
I try not to use |= and &= statements as earlier versions of BoostC compiled correctly but did not work correctly when writing code like this.
Maybe worth customizing the ADC sample function and adding the line there to see if it is the sample that is doing something
Posted: Fri Nov 19, 2010 1:11 pm
"What is happening when you try to use both together? Is the LCD failing or is it the pull ups?"
It where the pull-ups that where not working.
With intcon2 = intcon2 & 0x7F; it works as intended, thank you very much
Posted: Tue Dec 07, 2010 9:44 am
I have been progressing with this project and stumbled on new found problems closely related to my previous one.
I got the LCD working on portA
I got the pull-ups working on portB
I got the ADC channels 10,11 and 12 (on portB) working
But the other ADC channels on this port always return 254
I use this to initialize:
adcon0 = 0xf1;
intcon2 = intcon2 & 0x7f;
I know adcon0 = 0xf1;
selects an unimplemented adc channel but flowcode selects the channel with the macro anyway.
It also does not work if I change adcon0 so that it enables a channel that i can't get to work.
it's not required, because i could use channel 10,11 and 12 but id like to use channel 8 aswell.
any idea why the remaining channels on portB act different then 10,11 and 12?
I found how they are different, I first make the pin high to charge an external capacitor and then make a voltage division between the Cext and the Chold from the ADC to determine the Cext value. appearndly driving the pin of channel 10,11 and 12 high, doesnt charge the Chold if you make a ADC conversion, but on the other channels it does.
I solved this by making the ADC channel an input after Cext charging and before ADC conversion, works as a train now, sorry for the unneeded post.
Posted: Tue Dec 07, 2010 11:49 am
Great to hear you got it working and many thanks for posting the workaround to the problem.