Searching \ for 'In C, how do you set a pin to high voltage?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/power.htm?key=voltage
Search entire site for: 'In C, how do you set a pin to high voltage?'.

Truncated match.
PICList Thread
'In C, how do you set a pin to high voltage?'
2010\05\28@173127 by Xiao Xu

picon face
To set, for example RA0, to high in C, can you just do PORTA0=1?
- Xiao Xu

2010\05\28@175412 by Bruno L. Albrecht

picon face
compiler?
In C18, it's PORTAbits.RA0=1;

On Fri, May 28, 2010 at 6:31 PM, Xiao Xu <spam_OUTxiaoxu193TakeThisOuTspamgmail.com> wrote:

> To set, for example RA0, to high in C, can you just do PORTA0=1?
> - Xiao Xu
> -

2010\05\28@181120 by Mike Hagen

picon face
Try it in your particular C.  See if it works or gives an error.  Search
Help?  Look with Sim to see what works?

On 5/28/2010 2:31 PM, Xiao Xu wrote:
> To set, for example RA0, to high in C, can you just do PORTA0=1?
> - Xiao Xu
>    

2010\05\28@181415 by Xiao Xu

picon face
I'm using the HI-TECH C Compiler LIte
- Xiao Xu



On Fri, May 28, 2010 at 5:53 PM, Bruno L. Albrecht <.....brunolalbKILLspamspam@spam@gmail.com> wrote:
> compiler?
> In C18, it's PORTAbits.RA0=1;
>
> On Fri, May 28, 2010 at 6:31 PM, Xiao Xu <xiaoxu193spamKILLspamgmail.com> wrote:
>
>> To set, for example RA0, to high in C, can you just do PORTA0=1?
>> - Xiao Xu
>> --

2010\05\28@181815 by Bruno L. Albrecht

picon face
I'm not sure, but perhaps PORTA.RA0=1; may work...try that

On Fri, May 28, 2010 at 7:13 PM, Xiao Xu <.....xiaoxu193KILLspamspam.....gmail.com> wrote:

{Quote hidden}

2010\05\28@184514 by Oli Glaser

flavicon
face

----- Original Message -----
From: "Xiao Xu" <@spam@xiaoxu193KILLspamspamgmail.com>
To: "Microcontroller discussion list - Public." <KILLspampiclistKILLspamspammit.edu>
Sent: Friday, May 28, 2010 11:13 PM
Subject: Re: In C, how do you set a pin to high voltage?


> I'm using the HI-TECH C Compiler LIte
> - Xiao Xu

Okay, there should be some examples/info in the documentation to get you
going with things like this.
However, I've only used it a couple of times, but I remember having trouble
finding such basic info even in the bundled documentation. I *think* you can
just use something like RA0 = 1; for individual bits. Give that a go too.


2010\05\28@201357 by Xiao Xu

picon face
nope. I tried PORTAbits.RA0=1, PORTA.RA0=1.
During debugging, I looked into the file register, and 0x05 (location
for PORTA) never changed from 0.


- Xiao Xu



On Fri, May 28, 2010 at 5:53 PM, Bruno L. Albrecht <RemoveMEbrunolalbTakeThisOuTspamgmail.com> wrote:
> compiler?
> In C18, it's PORTAbits.RA0=1;
>
> On Fri, May 28, 2010 at 6:31 PM, Xiao Xu <spamBeGonexiaoxu193spamBeGonespamgmail.com> wrote:
>
>> To set, for example RA0, to high in C, can you just do PORTA0=1?
>> - Xiao Xu
>> --

2010\05\28@201516 by Xiao Xu

picon face
btw, here is my code if it helps:

#include <pic.h>
void main()
{

RA0=1;
PORTAbits.RA0=1;
NOP();
}

the 0-bit of PORTA(0x05 for 16F684) refuse to turn into 1!

- Xiao Xu



On Fri, May 28, 2010 at 8:13 PM, Xiao Xu <TakeThisOuTxiaoxu193EraseMEspamspam_OUTgmail.com> wrote:
{Quote hidden}

2010\05\28@203056 by Oli Glaser

flavicon
face
Something like this might work ( I assume you have the various config bits
set properly? watchdog timer off etc):

#include <pic.h>
void main()
{
PORTA = 0x00;
TRISA = 0x00;
RA0=1;

while(1);    // wait here
}


2010\05\28@203639 by Dwayne Reid

flavicon
face
For what its worth, I don't see anything that sets the TRIS bits for
that port.  Or is that something that the compiler is supposed to take care of?

dwayne


At 06:14 PM 5/28/2010, Xiao Xu wrote:
{Quote hidden}

--
Dwayne Reid   <EraseMEdwaynerspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax
http://www.trinity-electronics.com
Custom Electronics Design and Manufacturing

2010\05\28@225106 by RussellMc

face picon face
Hat: Helpful.

Please note that ALL posts should have a valid tag.

            [PIC] In C, how do you set a pin to high voltage?

Please add a valid tag to future posts in this thread.

Posts without a valid tag are probably seen by far less people than expected
and you may get less help than you expect.

Valid tags are preset by the system and are described in the FAQ.
at  http://www.piclist.com  PIC / SX  FAQ&list  archive

eg [PIC], [EE], [TECH], [OT], [AD], [AVR]  .... etc


                      Russell

More... (looser matching)
- Last day of these posts
- In 2010 , 2011 only
- Today
- New search...