Chester@CIS.UDEL.EDU wrote: > I am having trouble with getting nontrivial software to work on > the [16C84]. In particular, I can't get subroutine calls or > skip-on-zero instructions to work. Here is a test program that > illustrates the problem. It simply writes a 1 to rb0 and then > enters a loop in which 0 is written to rb0. An LED connected to > rb0 should stay off, since it is not on long enough to be visible. > > device pic16c84 > org 0 > movlw 0 > tris portb ; all port b pins are output > movlw 1 > movwf portb > flop call pause > goto flop > pause movlw 0 > movwf portb ; if this line commented out, LED is on > return > > This program was compiled by pasmx and was loaded into the chip with > the configuration word 1B. The LED stays on. Why? Daniel: You're right... It's a mystery. Since your code looks fine (assuming that "PORTB" is properly equated to "6"), I suspect that it's a hardware problem, either on your target board or in your chip programmer. In order from most-likely-to-produce-results to least-likely, here are the troubleshooting steps I'd take: 1. Do the simple ones first: Vdd should be a clean signal in the 3-5.5V range, and MCLR must be very clean and high. Make sure that there's a bypass cap between Vdd and Vss. 2. Put a scope on the OSC2 (not the OSC1) pin; you should see a steady waveform at 1/4 the R/C frequency. Since you say that you're loading the configuration word with 0x1B (Code Protect = OFF, Power-Up Timer = ON, Watchdog Timer = OFF, Oscillator Type = RC), I wouldn't expect you to see anything unusual here, but check anyway. In particular, if you see that the clock signal stops periodically, it's an indication that the Watchdog Timer isn't disabled and is resetting your PIC. 3. Since you're using a substandard assembler [my opinion only; others may disagree], you might want to make sure that it's generating the proper opcodes for the 16C84. Your program has 9 instructions; in order, they should assemble to: 3000 0066 3001 0086 2006 2804 3000 0086 0008 Let me know if any of this helps. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === === Custodian of the PICLIST Fund -- For more info, see: === http://www.geocities.com/SiliconValley/2499/fund.html