PICmicro & dsPIC >> PICmicro & dsPIC

Pages: 1
AouN
stranger


Reged: Aug 14 2009
Posts: 1
PIC16F690 I/O help
      #124362 - Fri Aug 14 2009 05:57 PM



This is my first time to work with PIC's, I have PICKit2 with PIC16F690. I need help in programming it.

Here is what I want to do:

I have the following 3 digital inputs, like this:

lets say I use RA0, RA1 and RA2:

state 1 | state2 |state3 |else

RA0: 0 | 1 | 1 | 1

RA1: 1 | 0 | 1 | 1

RA2: 1 | 1 | 0 | 1

I need the output to be as follow

RC0: 0 | 0 | 0 | 1

RC1: 0 | 1 | 0 | 1

RC2: 0 | 0 | 1 | 1



What command should I use and how please?

Thanks,


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 4622
Loc: Colorado
Re: PIC16F690 I/O help [Re: AouN]
      #124382 - Sat Aug 15 2009 04:56 AM

Quote:

What command should I use ...



C does not have "commands". It does have statements like if/else or switch/case, and data objects like arrays that could be used to perform the input-to-output mapping.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Neil_K

***

Reged: Mar 10 2005
Posts: 1824
Loc: NY,USA
Re: PIC16F690 I/O help [Re: AouN]
      #124402 - Sat Aug 15 2009 08:34 AM

RC0: 0 | 0 | 0 | 1

Does that mean something in some programing language?
does | mean or like in C.

Assuming Yes

RC0 = !RA0 | !RA1 | !RA2 | RA3 // is one way

or use if statments


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 4622
Loc: Colorado
Re: PIC16F690 I/O help [Re: Neil_K]
      #124522 - Sun Aug 16 2009 04:30 AM

Quote:

Does that mean something in some programing language?



I believe the OP was trying to post tables of input states and output states, but didn't use 'code' tags or preview. Had the OP used code tags:

Code:
       state 1  |  state2    |  state3  |else

RA0: 0 | 1 | 1 | 1
RA1: 1 | 0 | 1 | 1
RA2: 1 | 1 | 0 | 1

Code:
RC0:     0      |     0      |   0      |  1
RC1: 0 | 1 | 0 | 1
RC2: 0 | 0 | 1 | 1



Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 4622
Loc: Colorado
Re: PIC16F690 I/O help [Re: AouN]
      #124612 - Mon Aug 17 2009 10:01 PM

X-posted http://www.microchip.com/forums/fb.aspx?m=440797

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 21 anonymous users are browsing this forum.

Moderator:  mikerj, jtemples, jeff, Dan Henry, Andrew L 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 4633

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5