Simple PIC programming problem

Discussion in 'Embedded Systems and Microcontrollers' started by chrischristian, May 13, 2008.

  1. chrischristian

    Thread Starter Active Member

    Feb 22, 2008
    43
    0
    I have successfuly programmed LED flashing programme with those normal codes (MOV and all that..) now, I'm trying this XOR one but, don't understand why this is not working.


    Code ( (Unknown Language)):
    1. list p=16f690
    2.     #include<p16f690.inc>
    3.    
    4.     #define LED PORTC,0;Define pin 0 of port c as LED
    5.    
    6.     __CONFIG  _MCLRE_ON & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
    7.     ERRORLEVEL    -302
    8.  
    9. TEMP_VAR UDATA
    10. temp     RES 1
    11. delay1   RES 1;reserves 1 byte for delay1
    12. delay2   RES 1;reserves 1 byte for delay2
    13.  
    14. ;*******************************************************************
    15. Main:;Main programme begains
    16.     CODE 0x05; Start address at 0x05
    17. Setpins:; Select output and input
    18.     bsf STATUS,RP0 ;Switch to bank 1
    19.     movlw b'11110';MOVe 11110 to W
    20.     movwf TRISC    ;set pin 0 of PORT C as output
    21.     bcf STATUS,RP0 ;Switch back to bank 0
    22.     movlw b'00001';MOVe 00001 to W
    23. Start:
    24.     xorwf LED
    25.     call Loop
    26.     call Loop
    27.     goto Start
    28. Loop:
    29.     decfsz delay1,1
    30.     goto Loop
    31.     decfsz delay2,1
    32.     goto Loop
    33.     return
    34.     END
     
  2. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    4
    Try:

    xorwf PORTC, F

    Or change the definition of LED to PORTC, 1
     
    Last edited: May 13, 2008
  3. chrischristian

    Thread Starter Active Member

    Feb 22, 2008
    43
    0
    Thanks ! for that, actually it was the XOR problem as you said and also that I needed to make PORTC, 0 as digital output by :

    ANSEL,ANH04
     
Loading...