Subject: Re: [PIC]: Pic Basic Pro / Pic 16f818 Problem > I'm confused about the function of PBCONTROL. Is that an input > pin or an output pin? The Low command will automatically make it > an output. PBCONTROL is an output pin and its 'normal' state is high. It feeds to three paralleled pushbuttons via diodes and pull up resistors which return to three input pins (PB1, PB2 and PB3). The normal state of the inputs is high and pressing the push button sends that leg to ground which makes the corresponding input pin low. By making PBCONTROL low as the first step I am effectively turning off all the pushbuttons once one has been activated so that they cannot give a false trigger. > > If you're looking more for a "While button = pushed, do this" type > command, you want a "While PORTB.x = 0...Wend" statement. I am not after that from the buttons. What I was after was once a button is pressed turn them off and do this, then turn them back on again before returning to the main program. > > One more point- you really need to learn, use and love GoSub and > Return. Really. Really. Constant Goto hopping is a good way to > end up in a padded room. I looked at GoSub at first but realised that I didn't really want to come back to the start point when it came to the PB3SUB subroutine. Once the PB1SUB or PB2SUB routines had run through I needed them to go back to the main loop and not return to the PB3SUB. As a side note a padded room would be a comfort at the moment as banging my head off this desk while looking for an answer is begining to take a toll ;-) > > I know you don't want to hear this, but assembly code is the only > way to really know what PIC programming is all about. With the > 16F series, you have less than 40 commands to learn. If you don't > have a book, you need to get one. I'd suggest the Peatman books. Thanks for the book reference and I will bear that in mind. At the moment I simply do not have the resources to buy any books and I am having to educate myself via the net (I am disabled and the net is my window on the world). This hobby related project is being funded by a friend who asked me if I could come up with this device when he heard I had some hobby electronics experience. He has already sunk a fair bit of money into the project (in parts, programmer board etc.) and I feel somewhat guilty that I cannot get past this final hurdle due to my inexperience. I am convinced it is a simple error on my part but I just can't see where it is.....hence my original request. Thanks for taking the time to reply, Larry Green VE3YET -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads