On Tue, 7 Mar 2000, Steve Horvath wrote: > Hello > I am fairly new to PIC programming, but have a fair bit of experience form > school involving the Intel 8031. I was wondering if someone could write a > quick program (2 minute job) to do the fallowing on a 16f84, so that I > could learn about these functions by doing them: Hi Steve; Two minutes eh? Well, I give it a shot. On my mark, get set.....GO! > -push W onto a stack, and pop W off of the stack #include"include/stack.asm" call push call pop > - input from port A to W when there is an interrupt org 0x04 goto InterruptHandler InterruptHandler movf PORTA,w retfie > - have a 10ms delay using the timer bsf STATUS,RP0 ;go into page one movlw OPTIONInitial ;set the prescalar and things movwf OPTION_REG bcf STATUS,RP0 ;back down to page zero movlw TMR0TenMsDelayNumber movwf TMR0 LoopDeeDoo movwf TMR0 addwf 0x00 btfss STATUS,Z goto LoopDeeDoo > - output to pb.0 through pb.4 after the interrupt InteruptHandler andlw 0x0f ;mask off the unwanted bits andwf PORTB,w ;write to the port > - have a 1 second timer using loops, and have the output (port B) blink on > and off every second thereafter. > #define BIT ;any bit you want LoopDeeDoo call OneSecondTimerLoop btfsc PORTB,BIT ;Set yet? goto $+3 ;Yes-> reset it bsf PORTB,BIT ;No-> set it goto $+2 ;skip out bcf PORTB,BIT goto LoopDeeDoo > > oh, and could someone tell em the difference between portA and trisA? TRISA sets the direction. Remember 1 = Input > > thanks for your help, this should pretty well be what I need to get > everything straightened out. Stop! That took three minutes. Do I get payed overtime? No doubt all sorts of piclisters will be correcting it anyway... Steve, I have been playing with PICS when time permits for the last couple of years. Although my programming methods may be less then professional, I have found the little buggers most intriguing. I use a dt001 programmer and various simmsticks with pics on them. See http://www.dontronics.com. and http://www.wirz.com Although I really have nothing to compare with, it seems to be a good low-cost system. Freee programming and simulation software comes from Microchip See http://www.microchip.com > > Steve Horvath > Jeffrey D. Spears University of Michigan College of Engineering ``Double-E, can't spell gEEk without it!'' -Captain Gerald M. Bloomfield II, USMC (my brother)