View previous topic :: View next topic |
Author |
Message |
Guest
|
Can't get port pin HIGH using C |
Posted: Mon Nov 29, 2004 3:43 am |
|
|
Hi All,
This is the first time we have used the PCW compiler. Our problem is getting any PORT A or B pin high! This should be very simple but its just not working. Here is an example code.....
#include <16f876.h>
#use delay(4000000)
void main(){
while (1)
output_high(pin_a5);
}
Thanks in advance for your help, |
|
|
Guest
|
Re: Can't get port pin HIGH using C |
Posted: Mon Nov 29, 2004 3:57 am |
|
|
Anonymous wrote: | Hi All,
This is the first time we have used the PCW compiler. Our problem is getting any PORT A or B pin high! This should be very simple but its just not working. Here is an example code.....
#include <16f876.h>
#use delay(clock=4000000)
void main(){
while (1)
output_high(pin_a5);
}
Thanks in advance for your help, |
|
|
|
Guest
|
Re: Can't get port pin HIGH using C |
Posted: Mon Nov 29, 2004 4:15 am |
|
|
Anonymous wrote: | Anonymous wrote: | Hi All,
This is the first time we have used the PCW compiler. Our problem is getting any PORT A or B pin high! This should be very simple but its just not working. Here is an example code.....
#include <16f876.h>
#use delay(clock=4000000)
void main(){
while (1)
output_high(pin_a5);
}
Now when i test this on pin7 -> ra7 -> i only register a 2.75V on my multimeter!!!!
But if i do it in ASM i get 5V !
Thanks in advance for your help, |
|
|
|
|
Ttelmah Guest
|
|
Posted: Mon Nov 29, 2004 4:47 am |
|
|
I'm suprised you get 5v, using assembler to do the same...
The 876, wakes up, with the register ADCON1, set to all zeros. This configures the pins on portA, as AD inputs. In the assembler, you would have to be changing the contents of this register to get the pin to give an output, and the same applies in C.
The line:
Code: |
SETUP_ADC_PORTS(NO_ANALOGS);
|
Would configure the pins for digital I/O.
Best Wishes |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Mon Nov 29, 2004 4:48 am |
|
|
Post the .LST file. |
|
|
|