Greetings Ever since getting my programmer working (see previous post) I have now found myself with some programming problems. In other words...I program the chip...put it in my circuit, and it don't do what I want it to. But seriously here is what is happening. What I want it to do for now is read portb (pullups enabled) and, say portb:2 is low, toggle portc:2 and portd:2 to the opposite of what they were. I first wrote this code which is supposed to just read portb and copy it to portc and portd. The reason there is so much unneeded swapping and such to simplify my development later. ;============================================================= include list p=16f877 radix hex __CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC input equ 0x70 output equ 0x71 display equ 0x72 curscn equ 0x73 ;============================================================= ;Initialization routine ; Setup all ports, etc. ;============================================================= Start bcf status, rp0 bcf status, rp1 ;bank 0 bsf adcon1, 2 bsf adcon1, 3 ;ADC disable clrf porta clrf portb clrf portc clrf portd clrf porte ;Clear ports bsf status, rp0 ;Bank 1 clrf trisa ;PortA Outputs movlw 0xff movwf trisb ;PortB Inputs clrf portc ;PortC Outputs clrf portd ;PortD Outputs bcf trise, 4 ;Disable PSP bsf trise, 2 ;\ bsf trise, 1 ; PortE Inputs bsf trise, 0 ;/ bcf option_reg, 7 ;PortB Pullups On bsf pie2, 1 ;Enable EIEE bsf intcon, 6 ;Enable PIE bcf status, rp0 ;Bank 0 clrf portc clrf portd ;============================================================= ;Main Routine ;Just read input, copy to outputs ;Extra steps, getting ready for future ;============================================================= Main movf portb, w movwf input movf input, w movwf curscn movf curscn, w movwf output movwf display movf output, w movwf portd movf display, w movwf portc goto Main END ;============================================================= So I program the 16f877 with this, hook up LEDs and resistors to portc, a resonator for osc, and tie MCLR to high, and use a wire tied to ground to stimulate portb. The only thing that happens is when I ground RB3, all the LEDs light except one. I think I have some sort of problem with LVP turned on? If so, how do I disable it? If you have a code snippet that shows how to disable it, it would be appreciated. I know it's not the hardware because I also wrote a little program to just write a byte to portc and it works properly. Here is the code I have to toggle the bits on and off. It seems to work in the simulator near as I can tell. (Pin stimulation files are hard) I haven't been able to get it to work on the chip yet. My one concern is that the pic will read that port over and over and over while the button is pressed, and the output will just oscillate on and off. Anyways, here is the code, please feel free to comment and add suggestions. ;============================================================= include list p=16f877 radix hex __CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC input equ 0x70 output equ 0x71 display equ 0x72 curscn equ 0x73 ;============================================================= ;Initialization routine ; Setup all ports, etc. ;============================================================= Start bcf status, rp0 bcf status, rp1 ;bank 0 bsf adcon1, 2 bsf adcon1, 3 ;ADC disable clrf porta clrf portb clrf portc clrf portd clrf porte ;Clear ports bsf status, rp0 ;Bank 1 clrf trisa ;PortA Outputs movlw 0xff movwf trisb ;PortB Inputs clrf portc ;PortC Outputs clrf portd ;PortD Outputs bcf trise, 4 ;Disable PSP bsf trise, 2 ;\ bsf trise, 1 ; PortE Inputs bsf trise, 0 ;/ bcf option_reg, 7 ;PortB Pullups On bsf pie2, 1 ;Enable EIEE bsf intcon, 6 ;Enable PIE bcf status, rp0 ;Bank 0 clrf portc clrf portd ;============================================================= ;Main Routine ;Just read input, copy to outputs ;Extra steps, getting ready for future ;============================================================= Main movf portb, w movwf input comf input movf input, w xorwf curscn, f movf curscn, w movwf output movwf display movf output, w movwf portd movf display, w movwf portc goto Main END I know it isn't pretty, and there is a lot of redundant operations...stuff that could be accomplished in one operation. I hope someone can help. Thank you in advance! Josh Koffman joshy@mb.sympatico.ca