ardyna 0 Report post Posted September 22, 2007 Hi! I'm new to asm and hopefully everyone here will guide me with my pic. I use PIC16F628A. I have searched a lot of asm examples and tried to do the simplest thing to my pic. I made an asm code to on an LED as below but the LED does not turn on I'm not sure what's wrong with my program. Can someone help? LIST p=16F628a #include <P16F628a.inc> __Config _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _LVP_OFF & _MCLRE_OFF & _BODEN_OFF cblock h'20' endc dly equ 0x30 LED equ 0xff org 0x0000 start goto initialize initialize movlw 0x07 movwf CMCON bcf STATUS,RP1 bsf STATUS,RP0 clrf PIR1 clrf PORTA clrf PORTB movlw b'00000100' ; set RA2 = input dari switch others = output movwf TRISA ; '1' for input and '0' for output movlw 0x00 ; all output movwf TRISB ; main call onIRLED goto main onIRLED bsf PORTA,LED call delay bcf PORTA,LED return delay movlw d'255' movwf dly D1 decfsz dly,f goto D1 return END Quote Share this post Link to post Share on other sites
Sarma 0 Report post Posted November 19, 2007 Hi! I'm new to asm and hopefully everyone here will guide me with my pic. I use PIC16F628A. I have searched a lot of asm examples and tried to do the simplest thing to my pic. I made an asm code to on an LED as below but the LED does not turn on I'm not sure what's wrong with my program. Can someone help? -------------------------- /quote] I have tried to mod the program. the actual bit concerned- ididd not mind- it is working and the porta bits are changing. you may fine tune to what actually need. Quote Share this post Link to post Share on other sites
Sarma 0 Report post Posted November 19, 2007 (edited) Hi! I'm new to asm and hopefully everyone here will guide me with my pic. I use PIC16F628A. I have searched a lot of asm examples and tried to do the simplest thing to my pic. I made an asm code to on an LED as below but the LED does not turn on I'm not sure what's wrong with my program. Can someone help? please see this modded file . it is working and you may fine tune at bit level as per your requirements list p=16f628a #include <P16F628a.inc> __Config _CP_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _LVP_OFF & _MCLRE_OFF & _BODEN_OFF cblock h'20' endcdly equ 0x30LED equ 0x00 org 0x0000 start goto initialize initialize movlw 0x07 movwf CMCON bcf STATUS,RP1 bsf STATUS,RP0 clrf PIR1 clrf PORTA clrf PORTB bsf STATUS,RP0 movlw 0x00 ; set RA2 = input dari switch others = output movwf TRISA ; '1' for input and '0' for output movlw 0x00 ; all output movwf TRISB ; main call ONIRLED goto mainONIRLED bsf STATUS,RP0 movlw 0x00 movwf TRISA bcf STATUS,RP0 movlw 0xff movwf PORTA call delay movlw 0x00 movwf PORTA call delay returndelay movlw d'31' movwf dlyD1 decfsz dly,f goto D1 return END Edited November 20, 2007 by Sarma Quote Share this post Link to post Share on other sites