Heyas, To get myself accustomed to mcu programming I am trying to set up a = stoplight style program. I am using the onboard USART and can get chars transmitted and received = in hyperterminal. But I can't get the LEDs I attached to PortB bits 0, 1, and 2 to light up. Does the use of PortB as the serial comm port somehow make the other = bits on that port unusable? I've pasted my code below, I checked it a couple times for errors but = it's hard to set up a good test because of the need to go through the = USART. MPSIM doesn't have a way to set up stimulus files to do this = afaik. Thanks a bunch =20 // =3D=3D=3D=3D=3D Code Below =3D=3D=3D=3D=3D =20 ; Hardware Notes: PIC16F876 @ 4Mhz ; ; _MCLR pulled up through 10k-ohm ; RC6 - Serial Transmit Pin ; RC7 - Serial Receive Pin ; ; v1.0 LIST P=3D16F876, R=3DDEC INCLUDE "p16F876.inc" =20 CBLOCK 0x020 ; Var not used in this incarnation, was used = previously to SerTemp ; store the serial value to work with all = 3 lights. ENDC =20 __CONFIG _CP_OFF & _HS_OSC & _PWRTE_ON & _WDT_OFF & _BODEN_ON =20 ; Mainline org 0 =20 bcf PORTB, 0 ; PortB 0, off (Red) bcf PORTB, 1 ; PortB 1, off (Yellow) bcf PORTB, 2 ; PortB 2, off (Green) =20 bsf STATUS, RP0 ; Enable the Serial Port movlw (1 << TXEN) ; Enable Serial Transmission movwf TXSTA ^ 0x080 movlw 51 ; Serial Port running at 1200baud movwf SPBRG ^ 0x080 =20 bsf TRISB ^ 0x080, 0 ; Set PortB 0.1.2 to output bsf TRISB ^ 0x080, 1 bsf TRISB ^ 0x080, 2 =20 bcf STATUS, RP0 movlw (1 << SPEN) | (1 << CREN) movwf RCSTA ; Enable Serial I/O =20 Loop btfss PIR1, RCIF ; Wait for rx character set goto Loop ; Nothing there movf RCREG, 0 ; Get rx character bcf PIR1, RCIF ; Clear the Character Present Flag =20 ; Check the rx char against R, Y, G to set indicators ;movwf SerTemp ;sublw 'R' ;BTFSS STATUS, Z ; call GORED ;movf SerTemp, 0 ;movwf SerTemp ;sublw 'Y' ;BTFSS STATUS, Z ; call GOYEL ;movf SerTemp, 0 ;movwf SerTemp ;sublw 'G' ;BTFSS STATUS, Z ; call GOGRN ; =20 bsf PORTB, 0 ; Can I set the bits on at all? bsf PORTB, 1 =20 XORWF 'R', w BTFSS STATUS, Z ;call GORED ; Didn't work this way, trying to set it explicitly = below bsf PORTB, 0 =20 movwf TXREG ; Transmit char for error checking =20 goto Loop =20 ; Subroutines GORED: bsf PORTB, 0 bcf PORTB, 1 bcf PORTB, 2 goto Loop return =20 GOYEL: bcf PORTB, 0 bsf PORTB, 1 bcf PORTB, 2 goto Loop return =20 GOGRN: bcf PORTB, 0 bcf PORTB, 1 bsf PORTB, 2 goto Loop return end -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu