Pickit and pic help!
|
|
Turkey9
|
Thu Nov 20 2008, 04:46AM
|
|
|
Registered Member #1451
Joined: Wed Apr 23 2008, 03:48AM
Location: Boulder, Co
Posts: 661
|
I just recently bought the PICkit 2 board and have been having a lot of fun messing around with the programs and learning assembler. But i have ran into a problem that seems should be really simple to me, and my intended project can't continue until the problem is solved. The issue is this: how do i connect a switch to input? I'm looking for a way that i can initiate a sequence of delays and output pins with the press of a button. I've set the ports to input, used all kinds of loops, messed around with the ANSEL thing and i still can't get anything to work! Please help me out here! Also i'm still very new to this so if there is any good material you would recommend i read that would be great. Thanks!
|
Back to top
|
|
Carbon_Rod
|
|
Registered Member #65
Joined: Thu Feb 09 2006, 06:43AM
Location:
Posts: 1155
|
Get the student 18 C compiler (free). And this includes some example code.
1. Make sure flags default to digital i/o on start up 2. Initialize port direction configuration 3. Pull the input to vcc with a 10k resister (or portb pull ups enabled) 4. Switch ties input to ground 5. Read... C:: if(myPortMacroAlias.pin0 == 1)
ASM:: Read port, AND mask, and branch if not zero.
The Microchip forum is very helpful regarding chip specific assembly issues. Cheers,
|
Back to top
|
|
Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob
|
|
Powered by e107 Forum System
|