Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

is anything wrong with thw program??!!pic18f

Status
Not open for further replies.

vterminater

Junior Member level 1
Joined
Jul 16, 2010
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,413
pic18f

i am usin pic18f4550 with 20Mhz crystal and 22pf caps in my ckt...i wrote a program as follows
#include<p18f4550.inc>
config lvp=off
config debug=on
config wdt=off
config fosc=hs
config mclr=on
clrf trisd
clrf portd
l1:movlw 0xff
movwf portd
nop
nop
movlw 0x00
movwf portd
nop
nop
goto l1
end

is anything wrong with thw program??!!:| i get 0v at pin20..portd...:!:
 

Re: pic18f

Hi
you have passed 0xff to PORTD but after 3 instructions you again pass 0x00 to portd so ultimately you will get 0x00 at portd.

Recheck your code...

Regards.
 

pic18f

Hi,
The 0xff and then 0 is fine. You should get around 2v on your multimeter reading and some very high frequency(2-2.5MHz) reading on your frequency meter.
The problem is, you haven't initialized properly. You need to define where to go upon start up/reset, ie, from the reset vector. And, you have to define which microcontroller you are targeting.
So,
Code:
LIST P=18f4550
#INCLUDE "P18F4550.INC"
config lvp=off
config debug=on
config wdt=off
config fosc=hs
config mclr=on

org 0x00
goto startcode
;---------------------------
startcode
clrf TRISD
clrf PORTD
l1:movlw 0xff
movwf PORTD
nop
nop
movlw 0x00
movwf PORTD
nop
nop
goto l1
end

You should type the SFRs in capital letters, so that you have no problems when you use the include file, as here, the SFRs are declared in caps.

Hope this helps.
Tahmid.
 
oh my mistake!! only mistake was with the oscillator i was using! when switched to internal oscillator it worked just fine...thanks alot for replyin..best forum:D:D
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top