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.

Help me with basic program for using PIC16f84

Status
Not open for further replies.

mikelim

Newbie level 3
Joined
Feb 20, 2004
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
48
help on using 16f84

Hi there,
I am new on pic and I have troubles on getting my 16f84 to work. I wrote this simple basic program.

1. I used this free basic compiler and wrote the following. It should get the various indicated pins to be high / low. I wrote this delay subroutine but eventually remarked it out as I cannot even get the pins voltages correct.

_______________________________


bitset(rp0)
trisa=0
trisb=0
bitclear(rp0)

main:
ra.0=1
ra.1=1
ra.2=1
ra.3=1

rb.0=1
rb.1=1
rb.2=0
rb.3=1

'goto main:

'rem delay routing of 1.2s
'delay: i=200
' i2=200
' i3=10
' while i3>0
' while i2>0
' while i>0
' decr
' wend
' wend
' wend
'
' return

interrupt:

2. after using picbas, which is a free basic compiler, i obtained the following assembly code.

_______________________


include 'c:\pictools\16f84a.inc'
FUSES _XT_OSC
FUSES _WDT_OFF

DEVICE pic16c84,XT_OSC,WDT_OFF
org 0
JMP CC0
org 4
jmp INTERRUPT
CC0
; bitset(rp0)
setb RP0
; trisa=0
mov w,#0
mov 5,w
; trisb=0
mov w,#0
mov 6,w
; bi
jay says:
; bitclear(rp0)
clrb RP0
;
; main:
MAIN
; ra.0=1
mov w,#1
mov 13,w
; ra.1=1
mov w,#1
mov 14,w
; ra.2=1
mov w,#1
mov 15,w
; ra.3=1
mov w,#1
mov 16,w
;
; rb.0=1
mov w,#1
mov 17,w
; rb.1=1
mov w,#1
mov 18,w
; rb.2=0
mov w,#0
mov 19,w
; rb.3=1
mov w,#1
mov 20,w
;
; 'goto main:
;
; 'rem delay routing of 1.2s
; 'delay: i=200
; ' i2=200
; ' i3=10
; ' while i3>0
; ' while i2>0
; ' while i>0
; ' decr
; ' wend
; ' wend
; ' wend
; '
; ' return
;
; interrupt:
INTERRUPT
;

_____
(in it, i had too disable watchdog, i selected xt as i am using a 4mhz crystal.)

3. i then burnt in the machine code after assembling the above machine code using a jdm programmer/ and ic-prog

4. the circuitry connected to my 16f84a is as follows

pin 4 - a 20k resistor to 5V
pin 5 - 0V ref
pin 15 / 16 - a 4mhz crystal across
pin 15 - a cap to gnd 22uF
pin 16 - a cap to gnd 22uF
pin 17 - 5v

please help /advise.
thank you.

mike
 

Re: help on using 16f84

Hi there,

this site might help you:

h**p://www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uvod.htm

It has an onlone PIC 16F84 complete book for free.
If you browse the site a little you will find a book about BASIC programming for PIC.

Hope it helps :idea:
 

Re: help on using 16f84

hi dear check th sight h**p://www.mikroelektronika.co.yu/english/product/books/PICbook/0_Uvod.htm

take care
 

Re: help on using 16f84

Hi mikelim,

pin 4 - a 20k resistor to 5V
pin 5 - 0V ref
pin 15 / 16 - a 4mhz crystal across
pin 15 - a cap to gnd 22uF
pin 16 - a cap to gnd 22uF
pin 17 - 5v

-----------------------------

pin 15 and 16 use 22pF and not 22uF
pin17 - 5 V must be pin 14 and not pin 17

Also check this out if you are using 16F84A and ic-prog:
**broken link removed**

hope this helps
 

help on using 16f84

if you are using a 40 pin ZIF drive in the programmer circuit , then make sure the position of your microcontroller in ZIF drive. Different pin microcontroller are placed at different locations in the ZIF drive. Good Luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top