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 22pF
pin 16 - a cap to gnd 22pF
pin 17 - 5v
please help /advise.
thank you.
mike
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 22pF
pin 16 - a cap to gnd 22pF
pin 17 - 5v
please help /advise.
thank you.
mike