View previous topic :: View next topic |
Author |
Message |
Amin
Joined: 19 Feb 2004 Posts: 15
|
Each pin has a memory address? |
Posted: Sat Apr 23, 2005 3:45 pm |
|
|
Hi
I remember vaguely that each pin(let's say port B.1) aside from having an address as part of address X(3 or whatever for port B) bit 1, there is also a higher address which is directly that pin?
I can't seem to find it, but it seems to me using this as opposed to output_high or low specially without using FAST_IO is going to be much faster
thanks _________________ McMaster Solar Car Project
http://www.solarcar.mcmaster.ca |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Apr 23, 2005 4:44 pm |
|
|
Your memory is incorrect. The PIC does not map single pins to register addresses. |
|
|
Amin
Joined: 19 Feb 2004 Posts: 15
|
|
Posted: Sat Apr 23, 2005 5:20 pm |
|
|
thanks,
must have been some other controller :S
but is it right to assume that mapping a variable too the prt and reading it is faster than INPUT(PINXX) ?
looking at the assembly(.LST) it seems like it has a few lines for the INPUT function!
I am talking _________________ McMaster Solar Car Project
http://www.solarcar.mcmaster.ca |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Apr 23, 2005 7:58 pm |
|
|
Amin wrote: | thanks,
must have been some other controller :S
but is it right to assume that mapping a variable too the prt and reading it is faster than INPUT(PINXX) ?
looking at the assembly(.LST) it seems like it has a few lines for the INPUT function!
I am talking |
No, not really. That is all the input function does. The extra instructions are the handling of the trisc register and possibly the bank select. You can reduce the instruction count by using #use fast_io on the port and handle setting up the tris registers yourself. |
|
|
Amin
Joined: 19 Feb 2004 Posts: 15
|
changing A4 lowers A2 in 16F88 |
Posted: Sun Apr 24, 2005 1:00 pm |
|
|
Hi,
I have an issue with using PIN A2 in a 16F88.
I could raise and drop A2 normally. Until I raise A4 and then A2 drops RIGHT THERE. looking at the scope seems like one is the NOT of the other.
I tried all the registers that I could think of and noluck.
is there anything special up with this pin ?
My analog circuitary is turned off for A2 but they are being used for A0 and A1.
Thanks
Amin _________________ McMaster Solar Car Project
http://www.solarcar.mcmaster.ca |
|
|
Ttelmah Guest
|
|
Posted: Sun Apr 24, 2005 2:15 pm |
|
|
Does it behave as a 'not', or is it just that it goes low if you access any other pin in port A?.
The 'classic' problem, in this regard, is that whenever you change one pin on one of the standard PICs, the input register has to be read, the individual pin is then changed, and the result written back to the output register. If a pin is being prevented from reaching the level where it is 'seen' as having the expected value, then behaviour like you describe will occur.
This is more common on pins where the logic 'high' level is a greater value (schmitt trigger inputs), which does not apply in this case, but the low supply voltage supported by the chip, can cause this type of problem. What supply voltage are you running?. What voltage is actually 'on' Pin A2, when it is 'high'?. If (for instance), you are running on a low supply like 2v, the 'high' level needed on A2, will be 1.3v, and it des not take much load to prevent it reaching this level.
Best Wishes |
|
|
Ttelmah Guest
|
|
Posted: Sun Apr 24, 2005 2:19 pm |
|
|
Ongoing question.
What compiler version?.
There are problems with the F88, and compilers till quite recently, not correctly setting up the control registers for the ASC, and the comparators. Unless you have a recent compiler version, this could generate 'odd' problems of this sort.
Run the initialisation code in a simulator, and check what is written to the processor registers by the setup_comparators, and setup_adc commands.
Best Wishes |
|
|
Amin
Joined: 19 Feb 2004 Posts: 15
|
|
Posted: Thu Apr 28, 2005 10:46 am |
|
|
thanks guys for the response.
I am running at 5 volt and the pin wasn't driving anything but a scope and was not a NOT but the moment I touched anything else on PORTA it was happening.
for the record and to make sure other people could benefit from this in the archives:
It was a compiler problem as said. I just started setting the registers manually and it solved the problem. It left me with a bit of a bitter taste about the experience.
I am using some early 3.X version. |
|
|
|