Hi Graham, Mask out ; movfw 0x1ff ; remove this line, the W is automatically loaded. movwf OSCCAL ;Set oscillator calibration reg. ( let this be there ) Regards Pailoor Graham North wrote: > > I am have problems with a simple program to make leds flash with a 508. The > program simulates correctly, but when programmed the chip does nothing. > > Please can someone help me, it is probably something simple but I can not > see for looking! > > Graham > > Here is the code: > > list p=12c508 > include "p12c508.inc" > > radix dec > > __FUSES _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC > > cblock 0x07 ;Store variables above control registers > > TICKS > RTCC > > endc > > org 0x00 ;Start of code space > > SAME equ 1 > > Led1 equ 0 ;LED 1 connected to GP bit 0 > Led2 equ 1 ;LED 2 connected to GP bit 1 > > ;************************** Main ******************************** > > movfw 0x1ff > movwf OSCCAL ;Set oscillator calibration reg. > > start > movlw b'11000010' ;Set TMR0 prescaler = 1:8 (f_osc=4MHz) > option ;/ > > movlw b'00000000' ;Make all port bits outputs > tris GPIO ;/ > > Again ;do > bsf GPIO,Led1 ; Led1 on > call Wait_1sec ; Wait one sec > bcf GPIO,Led1 ; Led1 off > call Wait_1sec ; Wait one sec > bsf GPIO,Led2 ; Led2 on > call Wait_1sec ; Wait one sec > bcf GPIO,Led2 ; Led2 off > call Wait_1sec ; Wait one sec > > goto Again > > ;----------------------- SUBROUTINES ----------------------- > > Wait_1sec > ;One second delay subroutine > ;Generates delay by calling 5ms delay 200 times > > movlw .200 ;Init counter for 1 sec > movwf TICKS > > One_less ;do > call Wait_5ms ; wait 5 ms > decf TICKS,SAME ; decrement counter > btfss STATUS,Z ;while (count<>0) > goto One_less > return > > Wait_5ms > Delay subroutine using the timer, 4Mhz Xtal, 32 prescaler > Generates a delay of 5ms if Rtcc preloaded with 100 > > Wait_5ms ;do > movlw .100 ; Rtcc = 225 > movwf RTCC > Timer_check ;do > movf RTCC,W ; read Rtcc > btfss STATUS,Z > goto Timer_check ;while (Rtcc<>0) > return > > end -- WE DESIGN THE FUTURE Website : http://www.chiptechnologies.com Website : http://business.vsnl.com/chiptech Content-Type: text/x-vcard; charset=us-ascii; name="chiptech.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Ravi Pailoor Content-Disposition: attachment; filename="chiptech.vcf" Attachment converted: wonderland:chiptech.vcf 1 (TEXT/CSOm) (0000F8A5)