View Full Version : pic controller doesn't work properly
nightrider078
- 22nd September 2011, 19:53
my PIC 18f452 doesn't simulate program in hardware it will blink the LED when i touch my hand to one of the pin of OSI1 & OSI0 (oscillator pins)..the progrram is simulated in proteous7.7..plz solved my problem..
Ioannis
- 22nd September 2011, 20:13
Hmm, OK, I solved it!
Ioannis
c_moore
- 23rd September 2011, 00:40
Can you post the Code. Also What hardware are you using?
Jerson
- 23rd September 2011, 04:40
nightrider
Most likely source of your problem is you missed decoupling your circuit with 0.1uF capacitors. Second likely candidate is a noisy/bad switch mode power supply that you power your circuit with.
nightrider078
- 24th September 2011, 19:59
;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
mister_e
- 24th September 2011, 20:24
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 ;)
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.