Hi all, I finally got my PIC programmer (El Cheapo) working so I thought I would try my hand at a simple program. I wrote a program to count from 0 to 255 and display the contents of the count register on portb. I have a 10 LED dip package connected to portb, two of the LEDs are not connected. The pause routine I put in is simply to allow me some time to view the contents of portb. I realize that the tris command is obsolete and not recommended but I'm learning from a couple different books (Myke Predko's, and Easy Pic'n) and using the tris command seemed to be the easiest solution for my first program. In MPLAB I set up the PIC using XT for the resonator, 4Mhz for the speed, WDT disabled. The program compiles and burn into memory just fine but when I plug the chip into the circuit, nothing seems to happen. I am 99% sure I set up the circuit properly as I have checked and re-checked all the connections at least 10 times. I also stepped through the program listed below in MPLAB and it seemed to execute properly. Using watch windows in MPLAB everything checked out. As for the circuit, I started out using a 330 Ohm dip package in series with the anode pins of the LED dip package. Next I tried tying the cathode pins of the LED package to portb and the anode pins of the LEDs to 330 Ohm resistors. No LEDs turned on in either configurations. Any help is greatly appreciated. Sincerely, Scott Pierce ;== Scott Pierce ================================================ 8/24/2002 === ; ; Counts from 0 to 255 and displays contents on portb ; ; ;============================================================================== ; list p=16f84a radix hex ; ;============================================================================== ; portb equ 0x06 count equ 0x0c counti equ 0x0d countj equ 0x0e ; ;============================================================================== ; org 0x00 ; ;============================================================================== ; start movlw 0x00 tris portb ;set portb to all outputs movlw 0xff ;set portb high movwf portb ;set portb to all 0's clrf counti ;set counti to 0 clrf countj ;set countj to 0 clrf count ;set count to 0 ; ;============================================================================== ; dispcnt movf count,w ;move contents of count into work register movwf portb ;output contents of count to portb call pause incf count,f ;increment count by one, results stored in file reg goto dispcnt ;start loop over again ; ;============================================================================== ; pause movlw 0x0f ;set counter to 254 movwf counti ;move work register to counti file register loadj movlw 0x0f ;set countj to 255 movwf countj ;move work register to countj file register decj decfsz countj,f;decrement countj, if zero skip next instruction goto decj ;loop decj again until countj = 0 decfsz counti,f;decrement counti, if zero skip next instruction goto loadj ;loop loadj again until counti = 0 return ;when nested loops are done, return to dispcnt loop ; ;============================================================================== ; end ; ;============================================================================== -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads