Sorry about that! :-). Modified to show that porta=outs and portb=inputs. victor trisa=0 'porta all outs portb=255 'portb all ins switches var byte 'var to hold the value of portb porta=0 portb=0 start: while portb=0 wend switchon: while portb<>0 high porta.0 wend otherpin_on: ' low porta.0 'I'm not sure if you want to turn off this one here high porta.1 pause 3000 low porta.1 goto start end ----- Original Message ----- From: "L. Barta" To: "Microcontroller discussion list - Public." Sent: Sunday, May 21, 2006 9:46 PM Subject: Re: [PIC:]New to PicBasic and having a problem! > Victor, > Thanks a bunch but, all PortA pins are outputs and all PortB pins are > inputs. Can you modify your code slightly? > ----- Original Message ----- > From: "Victor Faria" > To: "Microcontroller discussion list - Public." > Sent: Sunday, May 21, 2006 7:20 PM > Subject: Re: [PIC:]New to PicBasic and having a problem! > > >> Lauren, >> here is something I whipped up quickly >> it did compile it seems ok try it and do with it what you want. >> but test and make sure it works ok >> Victor >> this is the bas file just paste it to your editor and compile it with >> PBP. >> Victor >> >> trisa=255 'porta all inputs >> trisb=0 'portb all outs >> switches var byte 'var to hold the value of portb >> porta=0 >> portb=0 >> start: >> while portb=0 'it will stay here as long as portb=0 >> >> wend >> switchon: >> while portb<>0 'it will stay here as long as portb <>0 >> >> high porta.0 >> wend >> otherpin_on: >> ' low porta.0 'I'm not sure if you want to turn off this >> one >> here >> high porta.1 >> pause 3000 >> low porta.1 >> goto start >> end >> ----- Original Message ----- >> From: "L. Barta" >> To: "Microcontroller discussion list - Public." >> Sent: Sunday, May 21, 2006 8:50 PM >> Subject: Re: [PIC:]New to PicBasic and having a problem! >> >> >>> Yep, I bought it a few days ago but haven't used it yet. Are there >>> advantages that could be used here? >>> ----- Original Message ----- >>> From: "Victor Faria" >>> To: "Microcontroller discussion list - Public." >>> Sent: Sunday, May 21, 2006 6:30 PM >>> Subject: Re: [PIC:]New to PicBasic and having a problem! >>> >>> >>>> I'm not Very familiar with the picbasic compiler. >>>> Do you have access to picbasic pro.?? >>>> if not I know there is a demo it is limited but it may be enough to do >>>> what >>>> you need. >>>> victor >>>> ----- Original Message ----- >>>> From: "L. Barta" >>>> To: "Microcontroller discussion list - Public." >>>> Sent: Sunday, May 21, 2006 8:08 PM >>>> Subject: Re: [PIC:]New to PicBasic and having a problem! >>>> >>>> >>>>> Yes I do and I've checked all inputs with a scope. They all go to + 5 >>>>> volts >>>>> when then should and drop to 0 volts when I remove the inputs. >>>>> ----- Original Message ----- >>>>> From: "Victor Faria" >>>>> To: "Microcontroller discussion list - Public." >>>>> Sent: Sunday, May 21, 2006 5:50 PM >>>>> Subject: Re: [PIC:]New to PicBasic and having a problem! >>>>> >>>>> >>>>>> Do you have resistors on your input pins??? >>>>>> victor >>>>>> ----- Original Message ----- >>>>>> From: "L. Barta" >>>>>> To: "Microcontroller discussion list - Public." >>>>>> Sent: Sunday, May 21, 2006 6:54 PM >>>>>> Subject: [PIC:]New to PicBasic and having a problem! >>>>>> >>>>>> >>>>>>> Hi Group, >>>>>>> >>>>>>> I'm fairly new at PIC programming and I'm having a problem writing >>>>>>> correct >>>>>>> PicBasic code. >>>>>>> If someone would be so kind as to tell me what I've done wrong, I'd >>>>>>> be >>>>>>> totally greatful! >>>>>>> >>>>>>> This is how it should work: >>>>>>> >>>>>>> I'm using PortB to read 8 switches. If any of these switches are >>>>>>> closed >>>>>>> (5 >>>>>>> volts on any PortB pin) >>>>>>> I want to put 5 volts out on PortA pin 0. This part of my program >>>>>>> seems >>>>>>> to >>>>>>> be ok. >>>>>>> >>>>>>> Now, after any or all of the PortB inputs have been high and ALL >>>>>>> have >>>>>>> gone >>>>>>> low, I want >>>>>>> to put 5 volts out on PortA pin 1 for 3 seconds. This part of my >>>>>>> program >>>>>>> seems to fail often! >>>>>>> >>>>>>> Thanks for any help you may be! >>>>>>> >>>>>>> Below, is the code I'm trying to use: >>>>>>> >>>>>>> 'The new Komatsu water truck at Wyodak has a serious problem. >>>>>>> 'Drivers have left the water pump switch on with no spray heads >>>>>>> 'turned on. This severly overheats the hydraulic system resulting >>>>>>> 'in pump and valve failures. >>>>>>> 'I've been asked to come up with a fix for it! >>>>>>> 'This device was designed to allow the water pump to only run >>>>>>> 'when at least one of the spray heads is turned on. There is >>>>>>> 'only one exception to this rule. At times, there may be the >>>>>>> 'need to run the pump for fire control. In this case an >>>>>>> 'input from a switch on the console will act as a spray head switch >>>>>>> 'allowing the pump to run. >>>>>>> 'We must provide two outputs, one to turn the pump on (RA0)and >>>>>>> another >>>>>>> 'to turn the pump off (RA1 High for 3 seconds)! >>>>>>> ' >>>>>>> 'Designed and Programmed for: Wyodak's Water Truck >>>>>>> 'Code Author: Lauren Barta >>>>>>> 'Designed and edited with: PicBasic >>>>>>> 'Started On: 04/06/2006 >>>>>>> 'Modified On: 05/18/2006 >>>>>>> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>>>>>> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' >>>>>>> Symbol TRISB = 134 'Symbol For TrisB Is Decimal 134 >>>>>>> Symbol TRISA = 133 'Symbol For TrisA Is Decimal 133 >>>>>>> Symbol PORTB = 6 'Symbol For PortB Is Decimal 6 >>>>>>> Symbol PORTA = 5 'Symbol For PortA Is Decimal 5 >>>>>>> >>>>>>> >>>>>>> Poke 134, 255 'Makes All PortB Pins Inputs >>>>>>> Poke 133, 0 'Makes All PortA Pins Outputs >>>>>>> >>>>>>> Start: >>>>>>> >>>>>>> Poke 5, 0 'Makes PortA Pins Low >>>>>>> Pause 10 'Short Pause >>>>>>> >>>>>>> Run: >>>>>>> LET B2 = 0 'Making B2 a zero >>>>>>> Pause 10 'Short Pause >>>>>>> Peek PortB, B0 'Look at PortB, put results in B0 >>>>>>> IF B0 = 0 Then Start 'If all PortB pins are low, go to Start >>>>>>> >>>>>>> Run2: 'Or Run2 if B0 is not equal to zero >>>>>>> >>>>>>> Poke 5, 1 'Makes PortA Pin (RA0) High and will turn the pump >>>>>>> on! >>>>>>> Pause 10 'Short Pause >>>>>>> Peek PortB, B2 'Look at PortB again, put contents in B2 >>>>>>> Pause 10 'Short Pause >>>>>>> IF B2 > 0 Then Run 'If B2 is greater than 0, go to run >>>>>>> >>>>>>> Run3: 'Or Run3 if B2 is equal to zero >>>>>>> >>>>>>> Pause 10 'Short Pause >>>>>>> Poke 5, 2 'Makes RA0 Low and RA1 High and turns the pump off! >>>>>>> Pause 3000 'Wait 3 seconds >>>>>>> Call Start 'Start all over again! >>>>>>> >>>>>>> End >>>>>>> >>>>>>> -- >>>>>>> http://www.piclist.com PIC/SX FAQ & list archive >>>>>>> View/change your membership options at >>>>>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>>>>> >>>>>> >>>>>> -- >>>>>> http://www.piclist.com PIC/SX FAQ & list archive >>>>>> View/change your membership options at >>>>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>>>> >>>>> >>>>> -- >>>>> http://www.piclist.com PIC/SX FAQ & list archive >>>>> View/change your membership options at >>>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>>> >>>> >>>> -- >>>> http://www.piclist.com PIC/SX FAQ & list archive >>>> View/change your membership options at >>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>> >>> >>> -- >>> http://www.piclist.com PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist