pic controller doesn't work properly


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: pic controller doesn't work properly

    ;Test Program
    LIST P=PIC18F452, F=INHX32, N=0, ST=OFF, R=HEX
    #INCLUDE P18F452.INC
    CONFIG OSC=HS, OSCS=OFF
    CONFIG WDT=OFF
    CONFIG BOR = OFF
    ;CONFIG BORV=0, PWRT=OFF
    CONFIG PWRT=OFF
    CONFIG DEBUG=OFF, LVP=OFF, STVR=OFF

    ;Equates Section
    TRISB EQU H'0F93'
    PORTB EQU H'0F81'
    R1 EQU 0x07
    R2 EQU 0x08

    ORG 0000H

    CLRF TRISB
    MOVLW 0x55
    MOVWF PORTB
    L3 COMF PORTB,F
    CALL QDELAY
    BRA L3


    ;------------1/4 SECOND DELAY
    QDELAY
    MOVLW D'200'
    MOVWF R1
    D1 MOVLW D'250'
    MOVWF R2
    D2 NOP
    NOP
    DECF R2,F
    BNZ D
    DECF R1,F
    BNZ D1
    RETURN

    END

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: pic controller doesn't work properly

    Code seems ok, but you don't need to redefine PORTB & TRISB... this is what the INCLUDE line does for you.

    You want to check MCLR pin, must be tied to Vdd.

    ALL VDD, ALL VSS pins MUST be connected.

    Check your crystal connection... and your capacitors around the crystal.

    Last thing, this is a Melabs PICBASIC forum here... with some tolerence & expertise for assembler
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts