Jim, You should still add delays in the routine where you are changing the state of PORTB. A NOP between them should be enough to see if RMW is a problem. Regards, Jim > -------- Original Message -------- > Subject: [PIC] PIC16F876A not changing output pins > From: Jim > Date: Thu, March 03, 2011 10:15 am > To: piclist >=20 >=20 > Hello, I am having trouble with a PIC16F876A, on an Olimex 28-pin dev boa= rd > (see http://www.sparkfun.com/products/18). The program downloads and > verifies successfully (or so the software tells me) via an meLabs U2 USB > programmer. In the past, I've had a couple PIC18 chips partially die on = me > without losing their ability to be programmed, so I'm wondering if that's > the case here, or if there's something wrong with my code. I have been > careful about grounding myself while handling both chips, although it's > possible that I forgot at some point while working on it with little slee= p. >=20 >=20 > > > I am trying to toggle all the pins of PORTB as a "hello world" test. It > works in the simulator, but apparently does nothing on the board. I have > already checked the supply voltage (+5.05V) and tested both chips on a > breadboard with all the I/O ports connected to GND with 1k resistors as > suggested here http://www.piclist.com/techref/logic/xtrapins.htm. Still > nothing on my scope, which is an old HP DSO with a 10 MHz sample rate. H= ere > is my assembly code: >=20 > > > list p=3D16f876a ; list directive to define processor >=20 > > #include "p16f876a.inc" ; processor specific variable definition= s >=20 > > > __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _RC_OSC & _LVP_OFF = & > _DEBUG_OFF & _CPD_OFF >=20 > > > ; '__CONFIG' directive is used to embed configuration data within .asm fi= le. >=20 > > ; The lables following the directive are located in the respective .inc > file. >=20 > > ; See respective data sheet for additional information on configuration > word. >=20 > > > ;***** VARIABLE DEFINITIONS >=20 > > ;; w_temp EQU 0x70 ; variable used for context saving >=20 > > ;; status_temp EQU 0x71 ; variable used for context saving >=20 > > > ;********************************************************************** >=20 > > ORG 0x000 ; processor reset vector >=20 > > clrf PCLATH ; ensure page bits are cleared >=20 > > ; goto main ; >=20 > > >=20 > ;; initialize PORTA >=20 > > bcf STATUS, RP0 ; select bank 0 >=20 > > bcf STATUS, RP1 >=20 > > clrf PORTB >=20 > > > bsf STATUS, RP0 ; select bank 1 >=20 > > movlw 0x06 >=20 > > movwf ADCON1 >=20 > > movlw 0x00 >=20 > > movwf TRISB >=20 > > > top: >=20 > > bcf STATUS, RP0 ; select bank 0 >=20 > > movlw 0x00 >=20 > > movwf PORTB >=20 > > movlw 0xFF >=20 > > movwf PORTB >=20 > > goto top >=20 > > END ; directive 'end of program' >=20 > > > Is there something wrong with this code, or is it definitely a hardware > issue? >=20 > > > Thanks, > Jim > --=20 > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .