CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Can't get port pin HIGH using C

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Can't get port pin HIGH using C
PostPosted: Mon Nov 29, 2004 3:43 am     Reply with quote

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
PostPosted: Mon Nov 29, 2004 3:57 am     Reply with quote

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
PostPosted: Mon Nov 29, 2004 4:15 am     Reply with quote

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







PostPosted: Mon Nov 29, 2004 4:47 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 29, 2004 4:48 am     Reply with quote

Post the .LST file.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group