PDA

View Full Version : pic16c54



necati
- 31st May 2005, 18:22
Hi,
I found a code in Microchip's site with extention "asm".
But I dont know how to convert it to hex file so can be put in pic16c54.

What program do I need for converting?

inside the file is like:

; *********************************************
; * PIC Egg Timer Give-Away *
; * *
; * Author: John Day *
; * Sr. Field Applications Engineer *
; * Northeast Region *
; * *
; * Revision: 1.2 *
; * Date September 22, 1994 *
; * Part: PIC16C54-LP/P or PIC16LC54A/P *
; * Fuses: OSC: LP *
; * WDT: OFF *
; * PuT: OFF *
; * CP: OFF *
; *********************************************
;
; This program is intended to run on a 32 Khz watch crystal and connects
; to four multiplexed seven segment displays. It displays the current
; time, alarm time and egg count down timers. There are switches that
; allow the user to set the alarm, timer and clock functions.

LIST F=INHX8M,P=16C54
INCLUDE "c:\pictools\picstarc\p16C5X.inc"
__FUSES _CP_OFF&_WDT_OFF&_LP_OSC

ORG 07h
; ****************************************
; * Static RAM Register File Definitions *
; ****************************************
INDADDR EQU 0 ; Indirect address register
DISPSEGS_A EQU 07h ; Current Display A segment bit pattern
DISPSEGS_B EQU 08h ; Current Display B segment bit pattern
DISPSEGS_C EQU 09h ; Current Display C segment bit pattern
DISPSEGS_D EQU 0Ah ; Current Display D segment bit pattern
CLK_SEC EQU 0Bh ; Clock second counter (0-59)
CLK_MIN_LD EQU 0Ch ; Clock minute low digit counter (0-9)
CLK_MIN_HD EQU 0Dh ; Clock minute high digit counter (0-5)
CLK_HOUR_LD EQU 0Eh ; Clock hour low digit counter (0-9)
CLK_HOUR_HD EQU 0Fh ; Clock hour high digit counter (0-2)
ALM_MIN_LD EQU 10h ; Alarm minute low digit counter (0-9)
ALM_MIN_HD EQU 11h ; Alarm minute high digit counter (0-5)
ALM_HOUR_LD EQU 12h ; Alarm hour lor digit counter (0-9)
ALM_HOUR_HD EQU 13h ; Alarm hour high digit counter (0-2)
TMR_SEC_LD EQU 14h ; Timer second low digit counter (0-9)
TMR_SEC_HD EQU 15h ; Timer second high digit counter (0-5)
TMR_MIN_LD EQU 16h ; Timer hour low digit counter (0-9)
TMR_MIN_HD EQU 17h ; Timer hour high digit counter (0-2)
KEYPAT EQU 18h ; Currently pressed key bits
FLAGS EQU 19h ; Status of alarms, display on, etc.
PREVTMR0 EQU 1Ah ; Used to determine which TMR0 bits changed
PREVSCAN EQU 1Bh ; Store Common Cathode display scan state
TEMP EQU 1Ch ; Temporary storage
DISPONCNT EQU 1Dh ; Time the displays have been on
MODE_COUNT EQU 1Eh ; Current mode state
ALARMCNT EQU 1Fh ; Time the alarm has been sounding
; ****************************************
; * Flag and state bit definitions *
; ****************************************
#define SECBIT TEMP,7 ; Bit to spawn 1/4 second count
#define SCANBIT TMR0,0 ; Bit to spawn display MUX
#define MODEKEY KEYPAT,4 ; Bit for MODEKEY pressed
#define UPKEY KEYPAT,6 ; Bit for UPKEY pressed
#define DOWNKEY KEYPAT,5 ; Bit for DOWNKEY pressed
#define MODEKEYCHG TEMP,4 ; Bit for delta MODEKEY
#define TIMENOW FLAGS,7 ; Flag to indicate 1 second passed
#define ALARMNOW FLAGS,3 ; Flag to indicate wakeup alarm
#define EGGNOW FLAGS,4 ; Flag to indicate egg timer alarm
#define ALARMOK STATUS,PA0 ; Flag to enable wakeup alarm
#define EGGOK STATUS,PA1 ; Flag to enable timer alarm


and goes on..........

mister_e
- 31st May 2005, 19:08
As far as i'm aware of, there's no program to translate from ASM to PBP. The only thing you can do is to learn Microchip's asm and do your own conversion.

There's some user here that know ASM but i feel that they won't do the whole translation... or not for free.

For what i read in the program header, you can do it easily. If you want to have my easy 1/2 hour code writing... Use a 12FXXX PIC serie(or whatever else), a DS1307 RTC and a 7 segment driver IC like MAX6958... not the cheapest solution but...

necati
- 1st June 2005, 08:43
It is strange that Microchip gives people the code which is useless then.

Ingvar
- 1st June 2005, 10:17
Use MPLAB to compile it, it's also free from Microchip.

Melanie
- 1st June 2005, 10:18
It's not useless... this is Assembler... download the FREE MPLAB software from the Microchip website... it contains the Assembler needed to convert the .asm into .hex which you can then use to program your PIC.

necati
- 1st June 2005, 14:16
I finally succeed making hexfile using mplab but only after deleting four lines from the asm code.Now I am not sure if it will work.
I will try..

mvs_sarma
- 22nd March 2006, 08:25
hello
the clk8.asm files is readily downloadable from microchip as part of AN615b and the same has been used by me ( of course i have locally compiled) and the same is working FINE.
Here one thing is to be noted . the common cathode wires coming from RA 0-RA-1 ,RA-2 and RA-3 may require rescheduling. Otherwise the display gets jumbled.

However PIC16C54a is an OTP device. Perhaps it is better if you can try a newer version PIC16F54 instead as this s flash programmable, by managing a suitable programmer

Thus, Necati may very well use it. ALL the best

I only wonder whether some has tried to modify this software to work on PIC16f84 and i request for help in this direction.

sarma

Acetronics2
- 22nd March 2006, 09:18
Hi, Sarma

Seems migrating from C54' to F84' is not so easy ...

first, have a look to Appendix C from 16F84 Datasheet : main explanations are here.

BUT ... if the programmer has used its own tricks ... that can be a bit harder !!!

I experience it on another clock program ( DCF Berliner Clock ) ... "basic" clock works well, but I still can't get the LED multiplexing work properly ...

it relates to Writing to the PC ... but where ???

good luck

Alain

mvs_sarma
- 15th October 2006, 16:59
hi, necati

hope you might have adopted the clk8.asm by converting the same to hex code

if so desired perhaps i could send clk8.hex copy

mvs_sarma
- 27th November 2006, 10:11
hello
I only wonder whether some has tried to modify this software to work on PIC16f84 and i request for help in this direction.

sarma

Hi all and Necati in particular,

I am now able to modified the an615 (clk8.asm to be able to work on 16F84A and i have two versions-- 1. with display OFF after 8 sec and 2. One to contiuously display-

i could send the .HEX file if someone wants.

Enquiries are welcome.