Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

NEED HELP 12C509 TO 16F84

Status
Not open for further replies.

Fragrance

Advanced Member level 4
Joined
Jul 26, 2002
Messages
1,191
Helped
247
Reputation
494
Reaction score
198
Trophy points
1,343
Location
East Of Earth
Activity points
8,916
Hi all,

I am sending a source code written for pic 12c509 chould any body help me how i can convert this for pic 16f84 chip because this chip is hard to find in country

regards

khalid :(
 

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,897
Helped
438
Reputation
880
Reaction score
287
Trophy points
1,363
Location
Oberon
Activity points
12,861
Greets, I have looked at your code, and although it is pretty straightforward to convert to a 1684, it will be time consuming. May I suggest that in future you make your code a little easier to understand, and easier to port. For example, this is your delay routine. It uses three variables 7, 8, 9, and one constant, 0x05. 7, 8, and 9 are not available on a 1684, so you have to change 6 values. Time consuming and error prone.

; * * * subroutine * * *

delay clrf 7
clrf 8
movlw 0x05 ; one second
movwf 9
dly decfsz 7
goto dly
decfsz 8
goto dly
decfsz 9
goto dly
retlw 0

Better is to use named variables:

;------ Delay variables

count1 equ 7
count2 equ 8
count3 equ 9

;------ Constant

time equ 0x05 ;one second delay

;------ Delay subroutine

delay clrf count1
clrf count2
movlw time
movwf count3
dly decfsz count1
goto dly
decfsz count2
goto dly
decfsz count3
goto dly
retlw 0

now, to change to a 1684, just change the equates to available ram.

Also with your i/o lines,

bcf 6,4 ; go on hook

pretty obscure? Better is to use named constant:

;------ i/o lines

hook equ 4

;------ code

bcf GPIO,hook

now, for a 1684, just change GPIO to Port_A, or whatever and update the equate.
Hope this is some help.
 

cheolim

Full Member level 1
Joined
Dec 3, 2002
Messages
97
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
873
Hello, KHALID BHATTI

I'd like to suggest you onething possibility to use 16F84.
Fourtunately, Hi@tech support free C-compiler for this device.
If you are familiar with embeded C programming, I'd like to suggest
you try it. You'll be somewhat free from some difficulties which are sticky
to hardware and easy to move device to device.

Good luck.
:roll:
 

Fragrance

Advanced Member level 4
Joined
Jul 26, 2002
Messages
1,191
Helped
247
Reputation
494
Reaction score
198
Trophy points
1,343
Location
East Of Earth
Activity points
8,916
btbass

Thanks friend btbass
It's nice idea i work on it if i feel any defficulty then i ask you again for kind guidance

regards
khalid
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top